From 09ed2fe825027a13f1cb7a4beaaf17d184ba61f7 Mon Sep 17 00:00:00 2001 From: Steffen Helmke Date: Fri, 14 Jan 2022 16:19:53 +0100 Subject: [PATCH] 4gewinnt: refactored playChip testmethods --- src/main/java/de/tims/viergewinnt/ai/Logic.java | 2 +- src/test/java/de/tims/viergewinnt/ai/LogicTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index dfad882..db16fdc 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -20,7 +20,7 @@ public class Logic { //add board update - //updateGui(playfield); + updateGui(playfield); testForWin(playfield, player); currentPlayer = (player % 2) + 1; return 0; diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index 3e344c4..2221c35 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java @@ -34,6 +34,7 @@ class LogicTest { int column = 0; int player = 1; int expectedResult = 0; + testObj.create4gewinntGui(); int realResult = testObj.playChip(playfield, column, player); assertEquals(expectedResult, realResult); @@ -46,6 +47,7 @@ class LogicTest { int player = 1; int expectedResult = 2; + testObj.create4gewinntGui(); testObj.playChip(playfield, column, player); int realResult = testObj.currentPlayer; @@ -59,6 +61,7 @@ class LogicTest { int player = 2; int expectedResult = 1; + testObj.create4gewinntGui(); testObj.playChip(playfield, column, player); int realResult = testObj.currentPlayer;