Commit fcf9e414 authored by Killian LUCAS's avatar Killian LUCAS
Browse files

GameTest.java update

parent ee1a6040
......@@ -10,18 +10,23 @@ import fr.univnantes.alma.server.game.item.board.BoardColor;
import fr.univnantes.alma.server.game.item.board.BoardDistribution;
import fr.univnantes.alma.server.game.item.board.Score;
import fr.univnantes.alma.server.game.item.card.PlaceCard;
import fr.univnantes.alma.server.game.item.card.SurvivalCard;
import fr.univnantes.alma.server.game.item.card.TrackingCard;
import fr.univnantes.alma.server.game.item.jeton.JetonSymbol;
import fr.univnantes.alma.server.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.server.game.item.planet.Place;
import fr.univnantes.alma.server.game.item.planet.Planet;
import fr.univnantes.alma.server.game.item.player.Creature;
import fr.univnantes.alma.server.game.utilitary.Pair;
import fr.univnantes.alma.server.user.PlayerProxy;
import fr.univnantes.alma.server.user.User;
import fr.univnantes.alma.thrift.Response;
import fr.univnantes.alma.thrift.TAskAction;
import org.apache.thrift.TException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import javax.sound.midi.Track;
import java.util.*;
import static fr.univnantes.alma.server.game.item.card.CardName.*;
......@@ -57,6 +62,7 @@ public class GameTest {
final PlaceCard pole = database.findPlaceCard(POLE.toString());
final PlaceCard fungi = database.findPlaceCard(FUNGI.toString());
final PlaceCard portail = database.findPlaceCard(PORTAIL.toString());
final TrackingCard acharnement = database.findTrackingCard(ACHARNEMENT.toString());
@BeforeEach
public void setUp() {
......@@ -205,13 +211,25 @@ public class GameTest {
assertEquals(new Score(1,2), board.getScore());
when(room.askAction(any(Integer.class), any(TAskAction.class)))
.thenReturn(new ActionChoosePower(0));
/* test for traque */
assertTrue(game.traqueCanResist());
assertTrue(game.traqueCanPickSurvivalCards());
/*test creaturePlayTrackingCard*/
Response response2 = new Response(false, "Unable to play this card");
assertEquals(response2,game.creaturePlayTrackingCard(game.getCreature(), acharnement));
assertEquals(game.getState(), Phase.PREPHASE_1);
assertTrue(game.playerHasFinished(1, Phase.PREPHASE_1).state);
assertTrue(game.playerHasFinished(2, Phase.PREPHASE_1).state);
assertEquals(game.getState(), Phase.PHASE_1);
assertTrue(game.playerHasFinished(1, Phase.PHASE_1).state);
assertFalse(game.playerHasFinished(2, Phase.PHASE_1).state);
/*Response response1 = new Response(true, "");
assertEquals(response1,game.playerPlayCard(2, riviere));*/
assertTrue(game.playerPlayCard(2, Collections.singletonList(plage)).state);
assertTrue(game.playerHasFinished(2, Phase.PHASE_1).state);
......@@ -222,8 +240,13 @@ public class GameTest {
assertTrue(game.playerHasFinished(1, Phase.PREPHASE_2).state);
assertTrue(game.playerHasFinished(2, Phase.PREPHASE_2).state);
/*test playerPlayCard*/
Response response = new Response(false, "No card authorize in this phase");
assertEquals(response, game.playerPlayCard(2, riviere));
assertFalse(game.playerHasFinished(1, Phase.PHASE_2).state);
assertTrue(game.playerPlaceJeton(1, Collections.singletonList(new PlacedJeton(JetonSymbol.CREATURE, Collections.singletonList(Place.PLACE_ONE)))).state);
assertTrue(game.playerHasFinished(1, Phase.PHASE_2).state);
assertTrue(game.playerHasFinished(2, Phase.PHASE_2).state);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment