1.1 --- a/chess/src/test/java/org/apidesign/html/demo/chess/BoardModelTest.java Tue Sep 24 22:37:17 2013 +0200
1.2 +++ b/chess/src/test/java/org/apidesign/html/demo/chess/BoardModelTest.java Wed Sep 25 04:18:47 2013 +0200
1.3 @@ -67,15 +67,6 @@
1.4
1.5 BoardModel.selected(b, e4);
1.6
1.7 - assertTrue(e4.isPending(), "e4 marked as pending move");
1.8 - assertNull(e2.getPiece(), "No pawn at e2");
1.9 -
1.10 - // ignore all other figures than the two pawns
1.11 - BoardModel.moveResponse(b, null, Collections.singletonList("Pe4"),
1.12 - Collections.singletonList("Pe7"), Color.B, null
1.13 - );
1.14 -
1.15 - assertFalse(e4.isPending(), "e4 now the move is real");
1.16 assertNull(e2.getPiece(), "No pawn at e2");
1.17 assertEquals(e4.getPiece(), BoardModel.PieceType.PAWN, "Pawn moved successfully");
1.18 assertNull(BoardModel.findSelectedSquare(b), "No square selected");
1.19 @@ -95,8 +86,6 @@
1.20
1.21
1.22 Square e7 = BoardModel.findSquare(b, 'E', 7);
1.23 - BoardModel.selected(b, e7);
1.24 - assertNull(BoardModel.findSelectedSquare(b), "Can't select anything when I am white player");
1.25
1.26 Move blackMv = BoardModel.MoveImpl.valueOf("E7E6");
1.27 BoardModel.moveUpdate(b, blackMv,
1.28 @@ -153,23 +142,10 @@
1.29
1.30 BoardModel.selected(b, e4);
1.31
1.32 - assertTrue(e4.isPending(), "e4 marked as pending move");
1.33 assertNull(e2.getPiece(), "No pawn at e2");
1.34
1.35 assertEquals(b.getMoves().size(), 1, "One move recorded");
1.36 assertEquals(b.getMoves().get(0), b.getPendingMove(), "Pending move is waiting");
1.37 -
1.38 - // ignore all other figures than the two pawns
1.39 - BoardModel.moveResponse(b, "No way, can't play like this", Collections.singletonList("PE2"),
1.40 - Collections.singletonList("Pe7"), Color.W, null
1.41 - );
1.42 -
1.43 - assertEquals(b.getAlertMessage(), "No way, can't play like this");
1.44 - assertNull(e4.getPiece(), "No piece on e4");
1.45 - assertEquals(e2.getPiece(), PieceType.PAWN, "Pawn is back");
1.46 -
1.47 - assertEquals(b.getMoves().size(), 0, "Move was discarded");
1.48 - assertNull(b.getPendingMove(), "No pending moves");
1.49 }
1.50
1.51 @Test public void cantSelectEmptySquare() {
1.52 @@ -235,21 +211,11 @@
1.53 BoardModel.selected(b, e2);
1.54 BoardModel.selected(b, e4);
1.55
1.56 - // ignore all other figures than the two pawns
1.57 - BoardModel.moveResponse(b, null, Collections.singletonList("PE4"),
1.58 - Collections.singletonList("PD7"), Color.B, null
1.59 - );
1.60 -
1.61 setPlayer(b, Color.B);
1.62
1.63 BoardModel.selected(b, d7);
1.64 BoardModel.selected(b, d5);
1.65
1.66 - // ignore all other figures than the two pawns
1.67 - BoardModel.moveResponse(b, null, Collections.singletonList("PE4"),
1.68 - Collections.singletonList("PD5"), Color.W, null
1.69 - );
1.70 -
1.71 setPlayer(b, Color.W);
1.72
1.73 BoardModel.selected(b, e4);
1.74 @@ -272,31 +238,16 @@
1.75 BoardModel.selected(b, e2);
1.76 BoardModel.selected(b, e4);
1.77
1.78 - // ignore all other figures than the three pawns
1.79 - BoardModel.moveResponse(b, null, Collections.singletonList("PE4"),
1.80 - Arrays.asList("PD7", "PE7"), Color.B, null
1.81 - );
1.82 -
1.83 setPlayer(b, Color.B);
1.84
1.85 BoardModel.selected(b, d7);
1.86 BoardModel.selected(b, d5);
1.87
1.88 - // ignore all other figures than the three pawns
1.89 - BoardModel.moveResponse(b, null, Collections.singletonList("PE4"),
1.90 - Arrays.asList("PD5", "PE7"), Color.W, null
1.91 - );
1.92 -
1.93 setPlayer(b, Color.W);
1.94
1.95 BoardModel.selected(b, e4);
1.96 BoardModel.selected(b, e5);
1.97
1.98 - // ignore all other figures than the three pawns
1.99 - BoardModel.moveResponse(b, null, Collections.singletonList("PE5"),
1.100 - Arrays.asList("PD5", "PE7"), Color.B, null
1.101 - );
1.102 -
1.103 setPlayer(b, Color.B);
1.104
1.105 BoardModel.selected(b, e7);
1.106 @@ -315,11 +266,6 @@
1.107 BoardModel.selected(b, e2);
1.108 BoardModel.selected(b, e4);
1.109
1.110 - // ignore all other figures than the two pawns
1.111 - BoardModel.moveResponse(b, null, Collections.singletonList("Pe4"),
1.112 - Collections.singletonList("PD7"), Color.B, null
1.113 - );
1.114 -
1.115 Move blackMv = BoardModel.MoveImpl.valueOf("D7D5");
1.116 BoardModel.moveUpdate(b, blackMv,
1.117 Collections.singletonList("PE4"),