()
| 95 | } |
| 96 | |
| 97 | @Test(expected = NoSuchElementException.class) |
| 98 | public void castleFail() { |
| 99 | Board board = new Board(); |
| 100 | board.placeKing(0, 4, Color.WHITE); |
| 101 | board.placeKing(7, 4, Color.BLACK); |
| 102 | board.placeRook(7, 7, Color.BLACK); |
| 103 | board.placeRook(7, 0, Color.BLACK); |
| 104 | board.placeBishop(7, 2, Color.BLACK); |
| 105 | board.placePawn(6, 5, Color.BLACK); |
| 106 | board.placePawn(6, 6, Color.BLACK); |
| 107 | board.placeRook(4, 7, Color.WHITE); |
| 108 | System.out.println(board); |
| 109 | System.out.println(board.getPiece(7, 4).getMoveList(board)); |
| 110 | Assert.assertEquals(5, board.getPiece(7, 4).getMoveList(board).size()); |
| 111 | Assert.assertTrue(board.getPiece(7, 4).getMoveList(board).stream().anyMatch(c -> Math.abs(c.piece.position.col - c.target.col) == 2)); |
| 112 | board.makeMove(board.getPiece(4, 7).getMoveList(board).stream().filter(c -> c.captureMove).findAny().get()); |
| 113 | System.out.println(board); |
| 114 | System.out.println(board.getPiece(7, 4).getMoveList(board)); |
| 115 | board.makeMove(board.getPiece(7, 4).getMoveList(board).stream().filter(c -> Math.abs(c.piece.position.col - c.target.col) == 2).findAny().get()); |
| 116 | } |
| 117 | |
| 118 | @Test(expected = NoSuchElementException.class) |
| 119 | public void castleFailWithKnightCapture() { |
nothing calls this directly
no test coverage detected