@Test public void testPlaceShip() throws ShipTooCloseException { Coordinate[] shipCoordinates = new Coordinate[] {new Coordinate(1, 1)}; battlefield.placeShip(shipCoordinates); assertArrayEquals(new Boolean[] {true}, battlefield.getShipsByCoordinates(shipCoordinates)); }
@Test(expected = ShipTooCloseException.class) public void testExceptionWhenShipsTooClose() throws ShipTooCloseException { battlefield.placeShip(new Coordinate[] {new Coordinate(1, 1), new Coordinate(1, 2)}); battlefield.placeShip(new Coordinate[] {new Coordinate(2, 1)}); }