From 2cb34b28d92174ddd3aa0d9c01362158f641f232 Mon Sep 17 00:00:00 2001 From: Malte Schellhardt Date: Mon, 14 Feb 2022 18:01:13 +0100 Subject: [PATCH] tictactoe: added test case to check end of game with empty board --- src/main/java/de/tims/tictactoe/GameLogic.java | 5 +++++ .../java/de/tims/tictactoe/GameLogicTest.java | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/main/java/de/tims/tictactoe/GameLogic.java b/src/main/java/de/tims/tictactoe/GameLogic.java index 36ccc8f..0b6f370 100644 --- a/src/main/java/de/tims/tictactoe/GameLogic.java +++ b/src/main/java/de/tims/tictactoe/GameLogic.java @@ -88,4 +88,9 @@ public class GameLogic { return finished; } + public boolean checkEndOfGame() { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/test/java/de/tims/tictactoe/GameLogicTest.java b/src/test/java/de/tims/tictactoe/GameLogicTest.java index 58abc9d..db9ab36 100644 --- a/src/test/java/de/tims/tictactoe/GameLogicTest.java +++ b/src/test/java/de/tims/tictactoe/GameLogicTest.java @@ -88,6 +88,14 @@ class GameLogicTest { assertEquals(expectedResult, realResult); } + @ParameterizedTest(name = "[{index}] {0}: should be {1}") + @MethodSource("testCasesForCheckEndOfGame") + void checkEndOfGameTest(String testName, boolean expectedResult, char[][] boardToCheck) { + boolean realResult = new GameLogic(boardToCheck).checkEndOfGame(); + + assertEquals(expectedResult, realResult); + } + private static Stream testCasesForCountPlayfields() { return Stream.of( Arguments.of("1x1 board with too few fields", 1, 9), @@ -212,5 +220,14 @@ class GameLogicTest { {'o', 'x', 'x'}}) ); } + + private static Stream testCasesForCheckEndOfGame() { + return Stream.of( + Arguments.of("check empty board", false, new char[][] + {{'-', '-', '-'}, + {'-', '-', '-'}, + {'-', '-', '-'}}) + ); + } }