From 2d4b0be4e578ae9653173bba429e404a7d84e862 Mon Sep 17 00:00:00 2001 From: Malte Schellhardt Date: Tue, 18 Jan 2022 16:10:53 +0100 Subject: [PATCH] 4gewinnt: added test for board with size 0 --- src/main/java/de/tims/viergewinnt/ai/Logic.java | 2 +- src/test/java/de/tims/viergewinnt/ai/LogicTest.java | 13 ++++++++++--- 2 files changed, 11 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 883335f..6151905 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -31,7 +31,7 @@ public class Logic { } public int getBoardSize() { - return 6; + return 0; } public void setCurrentPlayer(int player) { diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index c53ef6b..ab61f07 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java @@ -169,9 +169,10 @@ class LogicTest { assertEquals(expectedResult.getClass(), realResult.getClass()); } - @Test - void getBoardSize() { - int expectedResult = 6; + @ParameterizedTest(name = "[{index}] size {0}") + @MethodSource("boardSizeParameters") + void getBoardSize(String testName, int size) { + int expectedResult = size; int realResult = testObj.getBoardSize(); assertEquals(expectedResult, realResult); @@ -265,5 +266,11 @@ class LogicTest { Arguments.of("fullyFilled", playfield6, 2580) ); } + + private static Stream boardSizeParameters() { + return Stream.of( + Arguments.of("board with size 0", 0) + ); + } }