|
@ -63,7 +63,8 @@ class GameLogicTest { |
|
|
@ParameterizedTest(name = "[{index}] {0}") |
|
|
@ParameterizedTest(name = "[{index}] {0}") |
|
|
@MethodSource("testCasesForCheckEmptyField") |
|
|
@MethodSource("testCasesForCheckEmptyField") |
|
|
void fieldIsEmptyTest(String testName, int columnToCheck, int rowToCheck, boolean expectedResult, char[][] board) { |
|
|
void fieldIsEmptyTest(String testName, int columnToCheck, int rowToCheck, boolean expectedResult, char[][] board) { |
|
|
boolean realResult = this.game.fieldIsEmpty(columnToCheck, rowToCheck); |
|
|
|
|
|
|
|
|
GameLogic game = new GameLogic(board); |
|
|
|
|
|
boolean realResult = game.fieldIsEmpty(columnToCheck, rowToCheck); |
|
|
|
|
|
|
|
|
assertEquals(expectedResult, realResult); |
|
|
assertEquals(expectedResult, realResult); |
|
|
} |
|
|
} |
|
@ -94,9 +95,17 @@ class GameLogicTest { |
|
|
private static Stream<Arguments> testCasesForCheckEmptyField() { |
|
|
private static Stream<Arguments> testCasesForCheckEmptyField() { |
|
|
return Stream.of( |
|
|
return Stream.of( |
|
|
Arguments.of("check an empty field", 0, 0, true, new char[][] |
|
|
Arguments.of("check an empty field", 0, 0, true, new char[][] |
|
|
{{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}}) |
|
|
|
|
|
|
|
|
{{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}}), |
|
|
|
|
|
Arguments.of("check a field set by player 1", 0, 0, false, new char[][] |
|
|
|
|
|
{{'x', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}}), |
|
|
|
|
|
Arguments.of("check a field set by player 2", 0, 0, false, new char[][] |
|
|
|
|
|
{{'o', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}, |
|
|
|
|
|
{'-', '-', '-'}}) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|