diff --git a/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldPositioningTest.java b/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldPositioningTest.java index e969003..2fb254a 100644 --- a/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldPositioningTest.java +++ b/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldPositioningTest.java @@ -49,17 +49,24 @@ class MatchfieldPositioningTest { @ParameterizedTest(name = "ship positioning on invalid or valid coordinates") @MethodSource("testShipPositioningFailed") void testMatchfieldShipSetWithInvalidOrValidCoordinates(String testName, int matchfieldSize, Coordinate coordinate, - int direction, int length) { + int direction, int length, boolean expectedResult) { Matchfield matchfield = new Matchfield(matchfieldSize); matchfield.createMatchfield(); boolean calculatedResult = matchfield.setShip(coordinate, length, direction); - assertFalse(calculatedResult); + + if (expectedResult) + assertTrue(calculatedResult); + + if (!expectedResult) + assertFalse(calculatedResult); } static Stream testShipPositioningFailed() { - return Stream.of( - Arguments.of("invalid ship position from 9:0, length 2, direction 0", 10, new Coordinate(9, 0), 0, 2)); + Arguments.of("invalid ship position from 9:0, length 2, direction 0", 10, new Coordinate(9, 0), 0, 2, + false), + Arguments.of("valid ship position from 8:0, length 5, direction 1", 10, new Coordinate(9, 0), 1, 5, + true)); } }