Browse Source

refactoring: rearrange code structure

main
fdai7906 11 months ago
parent
commit
ba1bb9b313
  1. 37
      src/test/java/de/hsfulda/onses/GameTest.java

37
src/test/java/de/hsfulda/onses/GameTest.java

@ -12,39 +12,46 @@ public class GameTest {
@Test
@DisplayName("lastPlayedCard")
public void lastPlayedCard() {
// arrange
Game game = new Game();
Card card = new Card().setColor(Card.Color.RED).setValue(Card.Value.EIGHT);
Card card = new Card();
// act
card.setColor(Card.Color.RED).setValue(Card.Value.EIGHT);
Card answer = card;
game.setLastPlayedCard(card);
// assert
assertEquals(game.getLastPlayedCard(), answer);
}
@Test
@DisplayName("GetDrawCardDeck")
public void GetDrawCardDeck() {
// arrange
Game game = new Game();
Card card = new Card().setColor(Card.Color.RED).setValue(Card.Value.EIGHT);
Card card = new Card();
// act
card.setColor(Card.Color.RED).setValue(Card.Value.EIGHT);
Card answer = card;
game.addCardToDrawCardDeck(card);
// assert
assertEquals(game.getDrawCardDeck().getFirst(), answer);
}
@Test
@DisplayName("GetTwoCardsFromDrawCardDeck")
public void GetTwoCardsFromDrawCardDeck() {
// arrange
Game game = new Game();
Card card1 = new Card().setColor(Card.Color.RED).setValue(Card.Value.EIGHT);
Card card2 = new Card().setColor(Card.Color.BLUE).setValue(Card.Value.ONE);
Card card1 = new Card();
Card card2 = new Card();
// act
card1.setColor(Card.Color.RED).setValue(Card.Value.EIGHT);
card2.setColor(Card.Color.BLUE).setValue(Card.Value.ONE);
Card answer1 = card1;
Card answer2 = card2;
game.addCardToDrawCardDeck(card1);
game.addCardToDrawCardDeck(card2);
// assert
assertEquals(game.getDrawCardDeck().getFirst(), answer1);
assertEquals(game.getDrawCardDeck().get(1), answer2);
}
@ -63,10 +70,11 @@ public class GameTest {
@Test
@DisplayName("CheckForGetGameOver")
public void CheckForGetGameOver() {
// arrange
GameService gameService = new GameService();
// act
boolean gameOver = gameService.getGame().getGameOver();
//assert
assertFalse(gameOver);
}
@ -74,11 +82,12 @@ public class GameTest {
@Test
@DisplayName("CheckForSetGameOver")
public void CheckForSetGameOver() {
// arrange
GameService gameService = new GameService();
// act
gameService.getGame().setGameOver(true);
boolean gameOver = gameService.getGame().getGameOver();
// assert
assertTrue(gameOver);
}
}
Loading…
Cancel
Save