|
|
@ -1,11 +1,13 @@ |
|
|
|
package Game; |
|
|
|
|
|
|
|
import Game.ChessObj.ChessFigure; |
|
|
|
import org.junit.jupiter.api.AfterEach; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
|
|
|
import static org.junit.jupiter.api.Assertions.assertNull; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
class ChessTest { |
|
|
|
|
|
|
@ -40,4 +42,34 @@ class ChessTest { |
|
|
|
assertArrayEquals((chess.convertInput("3G")), test3); |
|
|
|
assertArrayEquals((chess.convertInput("G3")), test3); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void getSidebarFigures() { |
|
|
|
ArrayList<ChessFigure> array1 = new ArrayList<>(); |
|
|
|
ArrayList<ChessFigure> array2 = new ArrayList<>(); |
|
|
|
ArrayList<ChessFigure> array3 = new ArrayList<>(); |
|
|
|
ArrayList<String> expectedArray2 = new ArrayList<>(); |
|
|
|
ArrayList<String> expectedArray3 = new ArrayList<>(); |
|
|
|
|
|
|
|
array2.add(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE)); |
|
|
|
array2.add(new ChessFigure(ChessFigure.Type.BISHOP, ChessFigure.Team.WHITE)); |
|
|
|
array2.add(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE)); |
|
|
|
array2.add(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE)); |
|
|
|
array2.add(new ChessFigure(ChessFigure.Type.CASTLE, ChessFigure.Team.WHITE)); |
|
|
|
array2.add(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE)); |
|
|
|
|
|
|
|
expectedArray2.add(" o , I , o , o , T ,"); |
|
|
|
expectedArray2.add(" o "); |
|
|
|
|
|
|
|
array3.add(new ChessFigure(ChessFigure.Type.QUEEN, ChessFigure.Team.BLACK)); |
|
|
|
array3.add(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.BLACK)); |
|
|
|
array3.add(new ChessFigure(ChessFigure.Type.KING, ChessFigure.Team.BLACK)); |
|
|
|
array3.add(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.BLACK)); |
|
|
|
|
|
|
|
expectedArray3.add("|Q|,|o|,|K|,|o|"); |
|
|
|
|
|
|
|
assertEquals(0, chess.getSidebarFigures(array1, 5).size()); |
|
|
|
assertEquals(expectedArray2, chess.getSidebarFigures(array2, 5)); |
|
|
|
assertEquals(expectedArray3, chess.getSidebarFigures(array3, 5)); |
|
|
|
} |
|
|
|
} |