|
|
@ -0,0 +1,30 @@ |
|
|
|
package de.tims.tictactoe.ai; |
|
|
|
|
|
|
|
import static org.mockito.Mockito.*; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
|
import org.mockito.Mock; |
|
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
|
|
|
|
|
import de.tims.tictactoe.GameLogic; |
|
|
|
|
|
|
|
@ExtendWith(MockitoExtension.class) |
|
|
|
class AIHardTest { |
|
|
|
static int size = 3; |
|
|
|
|
|
|
|
@Mock |
|
|
|
private GameLogic gl; |
|
|
|
|
|
|
|
@Test |
|
|
|
void emptyBoardChooseMiddleField() { |
|
|
|
char realChar = 'o'; |
|
|
|
doReturn(new char[][] { {'-', '-', '-'}, {'-', '-', '-'}, {'-', '-', '-'} }).when(gl).getBoard(); |
|
|
|
|
|
|
|
TicTacToeAI ai = new AIHard(gl); |
|
|
|
ai.calculateNextMove(); |
|
|
|
|
|
|
|
verify(gl, times(1)).setField(1, 1, realChar); |
|
|
|
} |
|
|
|
|
|
|
|
} |