|
|
@ -143,6 +143,17 @@ class AIHardTest { |
|
|
|
verify(gl, times(1)).setField(1, 2, realChar); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void alwaysSetInTheNearestEdgeToOpponentsX() { |
|
|
|
char realChar = 'o'; |
|
|
|
doReturn(new char[][] { {'-', '-', '-'}, {'-', 'o', 'x'}, {'-', '-', '-'} }).when(gl).getBoard(); |
|
|
|
|
|
|
|
TicTacToeAI ai = new AIHard(gl); |
|
|
|
ai.calculateNextMove(); |
|
|
|
|
|
|
|
verify(gl, times(1)).setField(0, 2, realChar); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("testCasesForCountCharsInRow") |
|
|
|
void countCharsInRowTest(String testName, char[][] board, int rowNum, char charToCount, int expectedResult) { |
|
|
|