Ejemplo n.º 1
0
 @Test
 public void getPieceAt() {
   DeskImpl desk = dataHelper.getConfiguredDesk();
   DeskIterator deskIterator = desk.deskIterator("B3");
   Assert.assertEquals(deskIterator.getPieceAt(SOUTH), 'N');
   Assert.assertEquals(deskIterator.getPieceAt(NORTH.plus(NORTH).plus(NORTH).plus(EAST)), 'p');
 }
Ejemplo n.º 2
0
  @Test
  public void nextWhenDeskIsModified() {
    DeskImpl desk = dataHelper.getConfiguredDesk();
    desk.setPieceAt("C3", 'r');
    DeskIterator deskIterator = desk.deskIterator("B3");
    desk.setPieceAt("C3", 'R');

    Assert.assertEquals(deskIterator.next(), 'R');
  }
Ejemplo n.º 3
0
 @Test
 public void nextVector() {
   DeskImpl desk = dataHelper.getConfiguredDesk();
   DeskIterator deskIterator = desk.deskIterator("B3");
   int counter = 0;
   while (deskIterator.hasNext(MoveVectorImpl.EAST)) {
     deskIterator.next(MoveVectorImpl.EAST);
     counter++;
   }
   Assert.assertEquals(counter, 6);
   Assert.assertEquals(deskIterator.currentPosition(), "H3");
 }
Ejemplo n.º 4
0
  @Test
  public void next() {
    DeskImpl desk = dataHelper.getConfiguredDesk();
    DeskIterator deskIterator = desk.deskIterator("A1");
    int counter = 0;
    while (deskIterator.hasNext()) {
      deskIterator.next();
      counter++;
    }

    Assert.assertEquals(counter, 63);
    Assert.assertEquals(deskIterator.currentPosition(), "H8");
  }
Ejemplo n.º 5
0
 @Test
 public void toSquare() {
   DeskImpl desk = dataHelper.getConfiguredDesk();
   DeskIteratorImpl deskIterator = (DeskIteratorImpl) desk.deskIterator("A1");
   Assert.assertEquals(deskIterator.toSquare(0, 1), "B8");
 }