Browse Source

Refactoring: cleared-booleans are private now (add getters for Test)

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

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

@ -12,10 +12,10 @@ public class Logic {
private Coordinate lastShot;
public Coordinate target;
private boolean foundShip = false;
public boolean clearedAbove = false;
public boolean clearedBelow = false;
public boolean clearedRight = false;
public boolean clearedLeft = false;
private boolean clearedAbove = false;
private boolean clearedBelow = false;
private boolean clearedRight = false;
private boolean clearedLeft = false;
public Coordinate chooseField() {
ArrayList<Coordinate> possibleFields = new ArrayList<Coordinate>();
@ -124,4 +124,20 @@ public class Logic {
}
}
public boolean getClearedAbove() {
return this.clearedAbove;
}
public boolean getClearedBelow() {
return this.clearedBelow;
}
public boolean getClearedRight() {
return this.clearedRight;
}
public boolean getClearedLeft() {
return this.clearedLeft;
}
}

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

@ -138,7 +138,7 @@ class LogicTest {
logic.clearAbove(shot);
assertEquals(logic.clearedAbove, true);
assertEquals(logic.getClearedAbove(), true);
}
@Test
@ -155,7 +155,7 @@ class LogicTest {
logic.clearBelow(shot);
assertEquals(logic.clearedBelow, true);
assertEquals(logic.getClearedBelow(), true);
}
@Test
@ -172,7 +172,7 @@ class LogicTest {
logic.clearRight(shot);
assertEquals(logic.clearedRight, true);
assertEquals(logic.getClearedRight(), true);
}
@Test
@ -189,6 +189,6 @@ class LogicTest {
logic.clearLeft(shot);
assertEquals(logic.clearedLeft, true);
assertEquals(logic.getClearedLeft(), true);
}
}
Loading…
Cancel
Save