|
@ -1,6 +1,7 @@ |
|
|
package de.tims.fleetstorm.matchfield; |
|
|
package de.tims.fleetstorm.matchfield; |
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
import java.util.stream.Stream; |
|
@ -64,4 +65,15 @@ class CoordinateTest { |
|
|
Arguments.of("Field State is SHOT", new Coordinate(0, 1), Coordinate.SHOT)); |
|
|
Arguments.of("Field State is SHOT", new Coordinate(0, 1), Coordinate.SHOT)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testIfShootCheckWhenFieldIsAlreadyShot() { |
|
|
|
|
|
Matchfield matchfield = new Matchfield(10); |
|
|
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
|
|
|
|
// set dummy ship |
|
|
|
|
|
matchfield.setShip(new Coordinate(3, 3), 4, 1); |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(matchfield.getField(0, 0).shoot()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |