From 8915964ed0ea21de591eb45afca797cfaf01be38 Mon Sep 17 00:00:00 2001 From: Lorenz Hohmann Date: Wed, 2 Feb 2022 16:27:26 +0100 Subject: [PATCH] Added Test case when no ship is within the coordinates (isFree() method) --- .../tims/fleetstorm/matchfield/MatchfieldShipTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldShipTest.java b/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldShipTest.java index 019ebba..72a94c8 100644 --- a/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldShipTest.java +++ b/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 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)); } }