Browse Source

Refactoring: setLastShot() doesn't need param matchfield anymore

fleetstorm
Max Wenzel 3 years ago
committed by Lorenz Hohmann
parent
commit
ba00efe5e2
  1. 4
      src/main/java/de/tims/fleetstorm/ai/Logic.java
  2. 4
      src/test/java/de/tims/fleetstorm/ai/LogicTest.java

4
src/main/java/de/tims/fleetstorm/ai/Logic.java

@ -38,8 +38,8 @@ public class Logic {
return out;
}
public void setLastShot(Coordinate coordinate, Matchfield matchfield) {
lastShot = matchfield.getField(coordinate);
public void setLastShot(Coordinate coordinate) {
lastShot = this.matchfield.getField(coordinate);
}

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

@ -74,9 +74,10 @@ class LogicTest {
int size = 4;
matchfield = new Matchfield(size);
matchfield.createMatchfield();
logic.setMatchfield(matchfield);
Coordinate expectedResult = new Coordinate(2, 2);
logic.setLastShot(expectedResult, matchfield);
logic.setLastShot(expectedResult);
Coordinate result = logic.getLastShot();
assertEquals(result, expectedResult);
@ -96,7 +97,6 @@ class LogicTest {
logic.setMatchfield(matchfield);
result = logic.getMatchfield();
assertNotNull(result);
}
}
Loading…
Cancel
Save