public void tearDown() {
}
@Test
public void switchLettersTester() {
Player player = FACTORY.createPlayer(GAME, "test", 0, false, null);
System.out.println("Before: " + player.getRackLettersName());
try {
player.switchLetters(0, 1);
System.out.println("Normal switch (0, 1): " + player.getRackLettersName());
}
catch (ArrayIndexOutOfBoundsException e) {
fail("ArrayIndexOutOfBoundsException was not expected");
}
try {
player.switchLetters(-1, 0);
fail("ArrayIndexOutOfBoundsException was expected");
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Can't switch (-1, 0)");
}
try {
player.switchLetters(-1, -2);
fail("ArrayIndexOutOfBoundsException was expected");
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Can't switch (-1, -2)");
}
try {
player.switchLetters(2, 2);
System.out.println("Switch same letters (2, 2): " + player.getRackLettersName());
}
catch (ArrayIndexOutOfBoundsException e) {
fail("ArrayIndexOutOfBoundsException was not expected");
}
try {
player.switchLetters(3, 7);
fail("ArrayIndexOutOfBoundsException was expected");
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Can't switch (3, 7)");
}
try {
player.switchLetters(-7, 7);
fail("ArrayIndexOutOfBoundsException was expected");
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Can't switch (-1, 2)");
}