|
|
@ -80,10 +80,10 @@ class GameLogicTest { |
|
|
|
assertEquals(expectedResult, realResult); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest(name = "[{index}] {0}") |
|
|
|
@ParameterizedTest(name = "[{index}] {0}: should be {2}") |
|
|
|
@MethodSource("testCasesForCheckForWin") |
|
|
|
void checkForWinTest(String testName, boolean expectedResult, char[][] boardToCheck) { |
|
|
|
boolean realResult = new GameLogic(boardToCheck).checkForWin(); |
|
|
|
void checkForWinTest(String testName, char player, boolean expectedResult, char[][] boardToCheck) { |
|
|
|
boolean realResult = new GameLogic(boardToCheck).checkForWin(player); |
|
|
|
|
|
|
|
assertEquals(expectedResult, realResult); |
|
|
|
} |
|
|
@ -134,14 +134,18 @@ class GameLogicTest { |
|
|
|
|
|
|
|
private static Stream<Arguments> testCasesForCheckForWin() { |
|
|
|
return Stream.of( |
|
|
|
Arguments.of("check win for player 1", true, new char[][] |
|
|
|
{{'x', '-', '-'}, |
|
|
|
{'x', '-', '-'}, |
|
|
|
{'x', '-', '-'}}), |
|
|
|
Arguments.of("check win for player 2", true, new char[][] |
|
|
|
{{'o', '-', '-'}, |
|
|
|
{'o', '-', '-'}, |
|
|
|
{'o', '-', '-'}}) |
|
|
|
Arguments.of("check win for player 1", 'x', true, new char[][] |
|
|
|
{{'x', '-', '-'}, |
|
|
|
{'x', '-', '-'}, |
|
|
|
{'x', '-', '-'}}), |
|
|
|
Arguments.of("check win for player 2", 'o', true, new char[][] |
|
|
|
{{'o', '-', '-'}, |
|
|
|
{'o', '-', '-'}, |
|
|
|
{'o', '-', '-'}}), |
|
|
|
Arguments.of("check win for player 2", 'o', false, new char[][] |
|
|
|
{{'o', '-', '-'}, |
|
|
|
{'o', '-', '-'}, |
|
|
|
{'-', '-', '-'}}) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|