Browse Source

Refactoring testEverySecondField (override Equals of Coordinate)

Max Wenzel 3 years ago
parent
commit
8f8e32f378
  1. 8
      src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java
  2. 5
      src/test/java/de/tims/fleetstorm/ai/LogicTest.java

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

@ -32,4 +32,12 @@ public class Coordinate {
this.state = state;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Coordinate)) {
return false;
}
return this.x == ((Coordinate) obj).getX() && this.y == ((Coordinate) obj).getY();
}
}

5
src/test/java/de/tims/fleetstorm/ai/LogicTest.java

@ -64,9 +64,6 @@ class LogicTest {
expectedResult.add(new Coordinate(3, 1));
expectedResult.add(new Coordinate(3, 3));
for (int i = 0; i < expectedResult.size(); i++) {
assertEquals(everySecondField.get(i).getX(), expectedResult.get(i).getX());
assertEquals(everySecondField.get(i).getY(), expectedResult.get(i).getY());
}
assertEquals(everySecondField, expectedResult);
}
}
Loading…
Cancel
Save