code cleanup, lombok update to 1.88.22 due some compile issues with a new JDK
This commit is contained in:
parent
f72416b49a
commit
ed24bc0df1
2
pom.xml
2
pom.xml
@ -24,7 +24,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.18</version>
|
<version>1.18.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -10,10 +10,10 @@ import lombok.Getter;
|
|||||||
* @author steam
|
* @author steam
|
||||||
*
|
*
|
||||||
* this is a general command implementation.
|
* this is a general command implementation.
|
||||||
*
|
* <p>
|
||||||
* The arguments as {@link String} is intentionally, to be flexible
|
* The arguments as {@link String} is intentionally, to be flexible
|
||||||
* define some different argument formats.
|
* define some different argument formats.
|
||||||
*
|
* <p>
|
||||||
* Use some kind of {@link List} for arguments in futher implementations.
|
* Use some kind of {@link List} for arguments in futher implementations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -27,9 +27,9 @@ public class Command {
|
|||||||
public static final String PLACE = "PLACE";
|
public static final String PLACE = "PLACE";
|
||||||
public static final String REPORT = "REPORT";
|
public static final String REPORT = "REPORT";
|
||||||
|
|
||||||
private String command;
|
private final String command;
|
||||||
|
|
||||||
private Optional<String> arguments;
|
private final Optional<String> arguments;
|
||||||
|
|
||||||
public Command(final String command, Optional<String> arguments) {
|
public Command(final String command, Optional<String> arguments) {
|
||||||
this.command = command;
|
this.command = command;
|
||||||
|
@ -14,8 +14,8 @@ import lombok.ToString;
|
|||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class Position {
|
public class Position {
|
||||||
private int x;
|
private final int x;
|
||||||
private int y;
|
private final int y;
|
||||||
|
|
||||||
public Position() {
|
public Position() {
|
||||||
this.x = 0;
|
this.x = 0;
|
||||||
|
@ -11,8 +11,8 @@ import lombok.Getter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class ToyBotField {
|
public class ToyBotField {
|
||||||
private int width = 4;
|
private final int width = 4;
|
||||||
private int height = 4;
|
private final int height = 4;
|
||||||
|
|
||||||
public boolean isInsideTheField(final Position position) {
|
public boolean isInsideTheField(final Position position) {
|
||||||
return (position.getX() >= 0 &&
|
return (position.getX() >= 0 &&
|
||||||
|
@ -13,7 +13,7 @@ import de.dj_steam.bot.domain.ToyBot;
|
|||||||
*/
|
*/
|
||||||
public class DirectionCalculator {
|
public class DirectionCalculator {
|
||||||
|
|
||||||
private LoopedDirectionsArrayList<Direction> directions;
|
private final LoopedDirectionsArrayList<Direction> directions;
|
||||||
|
|
||||||
public DirectionCalculator() {
|
public DirectionCalculator() {
|
||||||
directions = new LoopedDirectionsArrayList();
|
directions = new LoopedDirectionsArrayList();
|
||||||
|
@ -12,7 +12,7 @@ import de.dj_steam.bot.moving.DirectionCalculator;
|
|||||||
*/
|
*/
|
||||||
public class TurnStrategy implements ChangingStrategy {
|
public class TurnStrategy implements ChangingStrategy {
|
||||||
|
|
||||||
private DirectionCalculator directionCalculator;
|
private final DirectionCalculator directionCalculator;
|
||||||
|
|
||||||
public TurnStrategy() {
|
public TurnStrategy() {
|
||||||
directionCalculator = new DirectionCalculator();
|
directionCalculator = new DirectionCalculator();
|
||||||
|
@ -15,12 +15,12 @@ public class LoopingConsoleTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test(expected = InvalidUserInputException.class)
|
@Test(expected = InvalidUserInputException.class)
|
||||||
public void createCommandExpectedUserInputExceptionOnEmptyInput() throws Exception {
|
public void createCommandExpectedUserInputExceptionOnEmptyInput() {
|
||||||
LoopingConsole.createCommand("");
|
LoopingConsole.createCommand("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = InvalidUserInputException.class)
|
@Test(expected = InvalidUserInputException.class)
|
||||||
public void createCommandExpectedUserInputExceptionOnMoreThenTwoParams() throws Exception {
|
public void createCommandExpectedUserInputExceptionOnMoreThenTwoParams() {
|
||||||
LoopingConsole.createCommand("INPUT X,Y,F WRONG_PARAM");
|
LoopingConsole.createCommand("INPUT X,Y,F WRONG_PARAM");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class ToyBotFieldTest {
|
public class ToyBotFieldTest {
|
||||||
@Test
|
@Test
|
||||||
public void isInsideTheField() throws Exception {
|
public void isInsideTheField() {
|
||||||
ToyBotField toyBotField = new ToyBotField();
|
ToyBotField toyBotField = new ToyBotField();
|
||||||
assertTrue(toyBotField.isInsideTheField(new Position(0,0)));
|
assertTrue(toyBotField.isInsideTheField(new Position(0,0)));
|
||||||
assertTrue(toyBotField.isInsideTheField(new Position(4,4)));
|
assertTrue(toyBotField.isInsideTheField(new Position(4,4)));
|
||||||
|
@ -26,7 +26,7 @@ public class ToyBotEngineTest {
|
|||||||
private Command moveCommand;
|
private Command moveCommand;
|
||||||
private Command placeCommand;
|
private Command placeCommand;
|
||||||
|
|
||||||
private ToyBotField toyBotField = new ToyBotField();
|
private final ToyBotField toyBotField = new ToyBotField();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user