|
@ -22,4 +22,23 @@ class CoordinateTest { |
|
|
assertEquals(coordinate.getState(), Coordinate.EMPTY); |
|
|
assertEquals(coordinate.getState(), Coordinate.EMPTY); |
|
|
assertEquals(coordinate.getState(), 0); |
|
|
assertEquals(coordinate.getState(), 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testGetAndSetForAllStates() { |
|
|
|
|
|
coordinate.setState(Coordinate.SHIP); |
|
|
|
|
|
assertEquals(coordinate.getState(), Coordinate.SHIP); |
|
|
|
|
|
assertEquals(coordinate.getState(), 1); |
|
|
|
|
|
|
|
|
|
|
|
coordinate.setState(Coordinate.SHOT); |
|
|
|
|
|
assertEquals(coordinate.getState(), Coordinate.SHOT); |
|
|
|
|
|
assertEquals(coordinate.getState(), 2); |
|
|
|
|
|
|
|
|
|
|
|
coordinate.setState(Coordinate.HIT); |
|
|
|
|
|
assertEquals(coordinate.getState(), Coordinate.HIT); |
|
|
|
|
|
assertEquals(coordinate.getState(), 3); |
|
|
|
|
|
|
|
|
|
|
|
coordinate.setState(Coordinate.EMPTY); |
|
|
|
|
|
assertEquals(coordinate.getState(), Coordinate.EMPTY); |
|
|
|
|
|
assertEquals(coordinate.getState(), 0); |
|
|
|
|
|
} |
|
|
} |
|
|
} |