|
|
@ -125,5 +125,17 @@ class AIHardTest { |
|
|
|
new char[][] { {'-', '-', 'o'}, {'o', 'o', '-'}, {'-', '-', '-'} }, |
|
|
|
1, 'o', 2)); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void invalidIndexCausesIndexOutOfBoundsException() { |
|
|
|
int index = 2; |
|
|
|
char charToCount = 'o'; |
|
|
|
String msg = "Only 0 and 1 are allowed values for index!"; |
|
|
|
doReturn(new char[][] { {'-', '-', '-'}, {'-', '-', '-'}, {'-', '-', '-'} }).when(gl).getBoard(); |
|
|
|
|
|
|
|
AIHard ai = new AIHard(gl); |
|
|
|
|
|
|
|
assertThatThrownBy(() -> {ai.countCharsInDiag(index, charToCount);}).isInstanceOf(IndexOutOfBoundsException.class).hasMessage(msg); |
|
|
|
} |
|
|
|
|
|
|
|
} |