From b11151562292e548e429de9848fa3ceefa337c4f Mon Sep 17 00:00:00 2001 From: Steffen Helmke Date: Wed, 5 Jan 2022 13:48:29 +0100 Subject: [PATCH] 4gewinnt: testForWin emtpy Field --- src/main/java/de/tims/viergewinnt/ai/Logic.java | 4 +++- src/test/java/de/tims/viergewinnt/ai/LogicTest.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index c66a520..d5a1f4c 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -1,5 +1,7 @@ package de.tims.viergewinnt.ai; public class Logic { - + public boolean testForWin(int[][] playfield, int player) { + return true; + } } diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index aeef208..e56560e 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java @@ -6,14 +6,22 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class LogicTest { + + private Logic testObj; @BeforeEach void setUp() throws Exception { + testObj = new Logic(); } @Test - void test() { - fail("Not yet implemented"); + void testForWinTest() { + int[][] testField = new int[6][6]; + boolean expectedResult = false; + + boolean realResult = testObj.testForWin(testField, 1); + + assertEquals(expectedResult, realResult); } }