diff --git a/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java b/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java index 3e16694..705c77c 100644 --- a/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java +++ b/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(); + } + } diff --git a/src/test/java/de/tims/fleetstorm/ai/LogicTest.java b/src/test/java/de/tims/fleetstorm/ai/LogicTest.java index 96d8eae..5eb55c0 100644 --- a/src/test/java/de/tims/fleetstorm/ai/LogicTest.java +++ b/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); } }