|
|
@ -6,6 +6,7 @@ import static org.junit.Assert.assertTrue; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
@ -69,4 +70,16 @@ class MatchfieldPositioningTest { |
|
|
|
Arguments.of("valid ship position from 8:0, length 5, direction 1", 10, new Coordinate(9, 0), 1, 5, |
|
|
|
true)); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void testShipPositionAlreadySetWithShip() { |
|
|
|
Matchfield matchfield = new Matchfield(10); |
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
matchfield.setShip(new Coordinate(0, 0), 5, 1); |
|
|
|
assertFalse(matchfield.setShip(new Coordinate(0, 1), 5, 1)); |
|
|
|
|
|
|
|
assertTrue(matchfield.setShip(new Coordinate(1, 1), 4, 0)); |
|
|
|
assertFalse(matchfield.setShip(new Coordinate(4, 1), 2, 1)); |
|
|
|
} |
|
|
|
} |