Browse Source

add DeafaultState(EMPTY) to Coordinate

fleetstorm
Max Wenzel 3 years ago
committed by Lorenz Hohmann
parent
commit
295ecd2bb1
  1. 10
      src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java
  2. 5
      src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java

10
src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java

@ -3,10 +3,17 @@ package de.tims.fleetstorm.matchfield;
public class Coordinate {
private int x;
private int y;
private int state;
public static final int EMPTY = 0;
public static final int SHIP = 1;
public static final int SHOT = 2;
public static final int HIT = 3;
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
this.state = 0;
}
public Integer getX() {
@ -17,4 +24,7 @@ public class Coordinate {
return y;
}
public int getState() {
return this.state;
}
}

5
src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java

@ -17,4 +17,9 @@ class CoordinateTest {
assertEquals(coordinate.getY(), y);
}
@Test
void testCoordinatehasDefaultStates() {
assertEquals(coordinate.getState(), Coordinate.EMPTY);
assertEquals(coordinate.getState(), 0);
}
}
Loading…
Cancel
Save