From ef0aac938329122fc1fb90908ce4887c96e20ff2 Mon Sep 17 00:00:00 2001 From: Malte Schellhardt Date: Mon, 14 Feb 2022 18:15:00 +0100 Subject: [PATCH] tictactoe: added test case to check end of game with win for player 1 --- src/main/java/de/tims/tictactoe/GameLogic.java | 2 +- src/test/java/de/tims/tictactoe/GameLogicTest.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/tims/tictactoe/GameLogic.java b/src/main/java/de/tims/tictactoe/GameLogic.java index 0b6f370..0aaac2b 100644 --- a/src/main/java/de/tims/tictactoe/GameLogic.java +++ b/src/main/java/de/tims/tictactoe/GameLogic.java @@ -89,7 +89,7 @@ public class GameLogic { } public boolean checkEndOfGame() { - // TODO Auto-generated method stub + if (checkForWin('x')) 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 db9ab36..1aa2d5e 100644 --- a/src/test/java/de/tims/tictactoe/GameLogicTest.java +++ b/src/test/java/de/tims/tictactoe/GameLogicTest.java @@ -226,7 +226,11 @@ class GameLogicTest { Arguments.of("check empty board", false, new char[][] {{'-', '-', '-'}, {'-', '-', '-'}, - {'-', '-', '-'}}) + {'-', '-', '-'}}), + Arguments.of("end of game with win for player 1", true, new char[][] + {{'x', 'o', 'x'}, + {'x', 'x', 'o'}, + {'x', 'o', 'o'}}) ); }