|
@ -11,7 +11,7 @@ import org.junit.jupiter.params.ParameterizedTest; |
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
class MatchfieldPositioningTest { |
|
|
|
|
|
|
|
|
class MatchfieldShipTest { |
|
|
|
|
|
|
|
|
@ParameterizedTest(name = "ship was set on the correct positions") |
|
|
@ParameterizedTest(name = "ship was set on the correct positions") |
|
|
@MethodSource("testShipPositioning") |
|
|
@MethodSource("testShipPositioning") |
|
@ -82,4 +82,15 @@ class MatchfieldPositioningTest { |
|
|
assertTrue(matchfield.setShip(new Coordinate(1, 1), 4, 0)); |
|
|
assertTrue(matchfield.setShip(new Coordinate(1, 1), 4, 0)); |
|
|
assertFalse(matchfield.setShip(new Coordinate(4, 1), 2, 1)); |
|
|
assertFalse(matchfield.setShip(new Coordinate(4, 1), 2, 1)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testIfAllShipsOnMatchfieldHit() { |
|
|
|
|
|
Matchfield matchfield = new Matchfield(10); |
|
|
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
|
|
|
|
matchfield.setShip(new Coordinate(0, 0), 5, 1); |
|
|
|
|
|
|
|
|
|
|
|
boolean calulatedResult = matchfield.areAllShipsHit(); |
|
|
|
|
|
assertFalse(calulatedResult); |
|
|
|
|
|
} |
|
|
} |
|
|
} |