Browse Source

Test.CheckCardRemovalFromBotDeck

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

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

@ -3,6 +3,7 @@ package de.hsfulda.onses;
import com.sun.tools.jconsole.JConsoleContext; import com.sun.tools.jconsole.JConsoleContext;
import de.hsfulda.onses.models.Card; import de.hsfulda.onses.models.Card;
import de.hsfulda.onses.services.GameService;
import de.hsfulda.onses.services.PlayerService; import de.hsfulda.onses.services.PlayerService;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -110,4 +111,25 @@ public class PlayerServiceTest {
assertEquals(before - 1, after); assertEquals(before - 1, after);
} }
@Test
@DisplayName("CheckCardRemovalFromBotDeck")
void CheckCardRemovalFromBotDeck() {
GameService gameService = new GameService();
Card card1 = new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.TWO);
Card card2 = new Card().setColor(Card.Color.RED).setValue(Card.Value.ONE);
gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.RED).setValue(Card.Value.FIVE));
gameService.getGame().getPlayerService().setCurrentTurn(false);
gameService.getGame().getPlayerService().getPlayerList().getLast().addCardToPlayerDeck(card1);
gameService.getGame().getPlayerService().getPlayerList().getLast().addCardToPlayerDeck(card2);
int before = gameService.getGame().getPlayerService().getPlayerList().getLast().getPlayerDeck().size();
gameService.getGame().getPlayerService().botMove();
int after = gameService.getGame().getPlayerService().getPlayerList().getLast().getPlayerDeck().size();
assertEquals(before - 1, after);
}
} }
Loading…
Cancel
Save