Browse Source

Added Test case when no ship is within the coordinates (isFree() method)

fleetstorm
Lorenz Hohmann 3 years ago
parent
commit
8915964ed0
  1. 9
      src/test/java/de/tims/fleetstorm/matchfield/MatchfieldShipTest.java

9
src/test/java/de/tims/fleetstorm/matchfield/MatchfieldShipTest.java

@ -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));
}
}
Loading…
Cancel
Save