From 3936ada743c578190ffad74aea47752d02045788 Mon Sep 17 00:00:00 2001 From: Malte Schellhardt Date: Mon, 14 Feb 2022 18:20:24 +0100 Subject: [PATCH] tictactoe: added test case to check end of game with win for player 2 --- src/main/java/de/tims/tictactoe/GameLogic.java | 1 + src/test/java/de/tims/tictactoe/GameLogicTest.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/tims/tictactoe/GameLogic.java b/src/main/java/de/tims/tictactoe/GameLogic.java index 0aaac2b..95aa451 100644 --- a/src/main/java/de/tims/tictactoe/GameLogic.java +++ b/src/main/java/de/tims/tictactoe/GameLogic.java @@ -90,6 +90,7 @@ public class GameLogic { public boolean checkEndOfGame() { if (checkForWin('x')) return true; + if (checkForWin('o')) return true; return false; } diff --git a/src/test/java/de/tims/tictactoe/GameLogicTest.java b/src/test/java/de/tims/tictactoe/GameLogicTest.java index 1aa2d5e..4f0e38b 100644 --- a/src/test/java/de/tims/tictactoe/GameLogicTest.java +++ b/src/test/java/de/tims/tictactoe/GameLogicTest.java @@ -230,7 +230,11 @@ class GameLogicTest { Arguments.of("end of game with win for player 1", true, new char[][] {{'x', 'o', 'x'}, {'x', 'x', 'o'}, - {'x', 'o', 'o'}}) + {'x', 'o', 'o'}}), + Arguments.of("end of game with win for player 2", true, new char[][] + {{'x', 'x', 'o'}, + {'o', 'o', 'o'}, + {'x', 'o', 'x'}}) ); }