Browse Source

Test.CheckForCardRemoval

main
fdai7793 11 months ago
parent
commit
7984827407
  1. 20
      src/test/java/de/hsfulda/onses/PlayerServiceTest.java

20
src/test/java/de/hsfulda/onses/PlayerServiceTest.java

@ -1,6 +1,8 @@
package de.hsfulda.onses;
import com.sun.tools.jconsole.JConsoleContext;
import de.hsfulda.onses.models.Card;
import de.hsfulda.onses.services.PlayerService;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@ -90,4 +92,22 @@ public class PlayerServiceTest {
assertEquals(expected, answer1);
assertEquals(expected, answer2);
}
@Test
@DisplayName("CheckForCardRemoval")
void CheckForCardRemoval() {
PlayerService playerService = new PlayerService();
Card card1 = new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.TWO);
Card card2 = new Card().setColor(Card.Color.RED).setValue(Card.Value.ONE);
playerService.getPlayerList().getFirst().addCardToPlayerDeck(card1);
playerService.getPlayerList().getFirst().addCardToPlayerDeck(card2);
int before = playerService.getPlayerList().getFirst().getPlayerDeck().size();
playerService.removeCardFromPlayerDeck(card1);
int after = playerService.getPlayerList().getFirst().getPlayerDeck().size();
assertEquals(before - 1, after);
}
}
Loading…
Cancel
Save