@ -45,7 +45,12 @@ public class Coordinate {
}
public void shoot() {
this.setState(Coordinate.HIT);
if (this.state == Coordinate.SHIP) {
this.state = Coordinate.HIT;
return;
this.state = Coordinate.SHOT;
@ -60,7 +60,8 @@ class CoordinateTest {
static Stream<Arguments> ShootFunctionFieldStates() {
return Stream.of(Arguments.of("Field State is HIT", new Coordinate(0, 0), Coordinate.HIT));
return Stream.of(Arguments.of("Field State is HIT", new Coordinate(0, 0), Coordinate.HIT),
Arguments.of("Field State is SHOT", new Coordinate(0, 1), Coordinate.SHOT));