@Test public void testIsNotPlaceableIfOtherShipBordersInYDirection() { board.placeShip(Ship.createHorizontal(new Position(0, 1), 5)); Ship ship = Ship.createHorizontal(new Position(0, 0), 1); assertThat(board.shipIsPlaceable(ship), is(false)); }
@Test public void testShipIsNotPlaceableIfOtherShipIsOnSpot() { board.placeShip(Ship.createHorizontal(new Position(0, 0), 5)); Ship ship = Ship.createHorizontal(new Position(4, 0), 2); assertThat(board.shipIsPlaceable(ship), is(false)); }
@Test public void testIsPlaceableInCorner() { Ship ship = Ship.createHorizontal(new Position(9, 9), 1); assertThat(board.shipIsPlaceable(ship), is(true)); }
@Test public void testIsNotPlaceableIfShipIsOutOfBoard() { Ship ship = Ship.createHorizontal(new Position(9, 9), 2); assertThat(board.shipIsPlaceable(ship), is(false)); }
@Test public void testShipIsPlaceableNextToEdge() { Ship ship = Ship.createHorizontal(new Position(0, 9), 5); assertThat(board.shipIsPlaceable(ship), is(true)); }
@Test public void testShipIsPlaceableForEmptyBoard() { Ship ship = Ship.createHorizontal(new Position(2, 2), 5); assertThat(board.shipIsPlaceable(ship), is(true)); }