コード例 #1
0
  @Test
  public void testPlaceShip() throws ShipTooCloseException {
    Coordinate[] shipCoordinates = new Coordinate[] {new Coordinate(1, 1)};
    battlefield.placeShip(shipCoordinates);

    assertArrayEquals(new Boolean[] {true}, battlefield.getShipsByCoordinates(shipCoordinates));
  }
コード例 #2
0
 @Test
 public void testInitiallyNoShips() {
   assertArrayEquals(
       new Boolean[] {false, false, false, false}, battlefield.getShipsByCoordinates(coordinates));
 }