|
@ -126,4 +126,16 @@ class AIHardTest { |
|
|
1, 'o', 2)); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |