From 2530467f141b7d53620546ea197451991566653b Mon Sep 17 00:00:00 2001 From: Malte Schellhardt Date: Tue, 18 Jan 2022 16:02:42 +0100 Subject: [PATCH] 4gewinnt: added getter method for board size --- src/main/java/de/tims/viergewinnt/ai/Logic.java | 4 ++++ .../java/de/tims/viergewinnt/ai/LogicTest.java | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index a208c96..883335f 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -30,6 +30,10 @@ public class Logic { return board[row][column]; } + public int getBoardSize() { + return 6; + } + public void setCurrentPlayer(int player) { currentPlayer = player; } diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index cda8cbe..c53ef6b 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java @@ -162,11 +162,19 @@ class LogicTest { @Test void createGameLogicTest() { - int size = 6; - Logic expectedResult = testObj; - Logic realResult = new Logic(size); + int size = 6; + Logic expectedResult = testObj; + Logic realResult = new Logic(size); - assertEquals(expectedResult.getClass(), realResult.getClass()); + assertEquals(expectedResult.getClass(), realResult.getClass()); + } + + @Test + void getBoardSize() { + int expectedResult = 6; + int realResult = testObj.getBoardSize(); + + assertEquals(expectedResult, realResult); } private static Stream playfieldResults() {