Browse Source

refactoring: remove useless variable in legalMove

main
fdai7920 11 months ago
parent
commit
d5b3b8236f
  1. 2
      src/main/java/de/hsfulda/onses/services/GameService.java
  2. 12
      src/test/java/de/hsfulda/onses/GameServiceTest.java

2
src/main/java/de/hsfulda/onses/services/GameService.java

@ -76,7 +76,7 @@ public class GameService {
}
}
public boolean legalMove(Player player, Card card)
public boolean legalMove(Card card)
{
boolean legalMoveFound = false;
Card lastCard = game.getLastPlayedCard();

12
src/test/java/de/hsfulda/onses/GameServiceTest.java

@ -46,7 +46,7 @@ public class GameServiceTest {
GameService gameService = new GameService();
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.RED).setValue(Card.Value.FIVE));
boolean answer = gameService.legalMove(new Player(), input);
boolean answer = gameService.legalMove(input);
// assert
assertEquals(expected, answer);
}
@ -60,7 +60,7 @@ public class GameServiceTest {
GameService gameService = new GameService();
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.BLUE).setValue(Card.Value.ONE));
boolean answer = gameService.legalMove(new Player(), input);
boolean answer = gameService.legalMove(input);
// assert
assertEquals(expected, answer);
}
@ -86,7 +86,7 @@ public class GameServiceTest {
GameService gameService = new GameService();
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.ONE));
boolean answer = gameService.legalMove(new Player(), input);
boolean answer = gameService.legalMove(input);
// assert
assertEquals(expected, answer);
}
@ -101,7 +101,7 @@ public class GameServiceTest {
GameService gameService = new GameService();
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.THREE));
boolean answer = gameService.legalMove(new Player(), input);
boolean answer = gameService.legalMove(input);
// assert
assertEquals(expected, answer);
}
@ -116,7 +116,7 @@ public class GameServiceTest {
GameService gameService = new GameService();
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.THREE));
boolean answer = gameService.legalMove(new Player(), input);
boolean answer = gameService.legalMove(input);
// assert
assertEquals(expected, answer);
}
@ -131,7 +131,7 @@ public class GameServiceTest {
GameService gameService = new GameService();
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.GREEN).setValue(Card.Value.FIVE));
boolean answer = gameService.legalMove(new Player(), input);
boolean answer = gameService.legalMove(input);
// assert
assertEquals(expected, answer);
}

Loading…
Cancel
Save