|
|
@ -128,7 +128,7 @@ class MatchfieldShipTest { |
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield returns correct state if a position is free or not") |
|
|
|
@MethodSource("testIsFreeMethod") |
|
|
|
void testMatchfieldReturnsCorrectValueAboutFreeCoorinateSlots(String testName, Coordinate originCoordinate, |
|
|
|
void testMatchfieldReturnsCorrectValueAboutFreeCoordinateSlots(String testName, Coordinate originCoordinate, |
|
|
|
int direction, int length, Coordinate[] coordinatesWithShip, boolean expectedResult) { |
|
|
|
|
|
|
|
Matchfield matchfield = new Matchfield(matchfieldSize); |
|
|
@ -144,7 +144,10 @@ class MatchfieldShipTest { |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> testIsFreeMethod() { |
|
|
|
return Stream.of(Arguments.of("one ship is within the coordinates", new Coordinate(0, 0), 1, 2, |
|
|
|
new Coordinate[] { new Coordinate(0, 0) }, false)); |
|
|
|
return Stream.of( |
|
|
|
Arguments.of("one ship is within the coordinates", new Coordinate(0, 0), 1, 2, |
|
|
|
new Coordinate[] { new Coordinate(0, 0) }, false), |
|
|
|
Arguments.of("no ship is within the coordinates", new Coordinate(1, 1), 0, 5, new Coordinate[] {}, |
|
|
|
true)); |
|
|
|
} |
|
|
|
} |