Commit 2401f0b7 authored by Corentin Guillevic's avatar Corentin Guillevic
Browse files
parents 957c14ce 5475f181
......@@ -448,6 +448,104 @@ class GameTest {
Response response = new Response(false, "Unable to play this card");
assertEquals(response,game.traquePlayPlaceCard(game.getTraques().get(0), riviere));
}
@Test
void testPlayerGiveUp_errorCreature() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
Response response = new Response(false, "Only traque can resist");
assertEquals(response,game.playerGiveUp(1));
}
@Test
void testPlayerGiveUp_errorBadPhase() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
game.startNextPhase();
game.startNextPhase();
//Start phase2
game.startNextPhase();
assertEquals(Phase.PHASE_2,game.getState());
Response response = new Response(false, "Give up is only possible in PHASE_1");
assertEquals(response,game.playerGiveUp(2));
}
@Test
void testPlayerGiveUp_true() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
Response response = new Response(true, "");
assertEquals(response,game.playerGiveUp(2));
}
@Test
void testPlayerGiveUp_falseCantGiveUp() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
game.getTraques().get(0).setCanGiveUp(false);
Response response = new Response(false, "You can't resist");
assertEquals(response,game.playerGiveUp(2));
}
@Test
void testPlayerPlayPlayerCard_falseNeedSurvivalCard() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
game.getTraques().get(0).getSurvivalCardsHand().add(vaccin);
game.getTraques().get(0).setCanGiveUp(false);
Response response = new Response(false, "Need a survival card");
assertEquals(response,game.playerPlayPlayerCard(game.getPlayer(2),acharnement));
} @Test
void testPlayerPlayPlayerCard_falseNeedTrackingCard() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
game.getTraques().get(0).getSurvivalCardsHand().add(vaccin);
game.getTraques().get(0).setCanGiveUp(false);
Response response = new Response(false, "Need a tracking card");
assertEquals(response,game.playerPlayPlayerCard(game.getPlayer(1),vaccin));
}
@Test
void testPlayerPlayPlayerCard_falseNeedSurvivalCardList() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
game.getTraques().get(0).getSurvivalCardsHand().add(vaccin);
game.getTraques().get(0).setCanGiveUp(false);
Response response = new Response(false, "Need a survival card");
assertEquals(response,game.playerPlayPlayerCard(game.getPlayer(2),Arrays.asList(acharnement)));
} @Test
void testPlayerPlayPlayerCard_falseNeedTrackingCardList() {
Room room = mock(Room.class);
List<Pair<Integer, String>> list = new ArrayList<>(Arrays.asList(new Pair<>(1, "Nathan"), new Pair<>(2, "Odile")));
Game game = new Game(list, 1, planet, board, room);
//Start phase1
game.startNextPhase();
game.getTraques().get(0).getSurvivalCardsHand().add(vaccin);
game.getTraques().get(0).setCanGiveUp(false);
Response response = new Response(false, "Need a tracking card");
assertEquals(response,game.playerPlayPlayerCard(game.getPlayer(1),Arrays.asList(vaccin)));
}
@Test
void testGameScenario() throws TException {
......
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