Commit 62263f09 authored by Killian LUCAS's avatar Killian LUCAS
Browse files

GameTest.java update add of several test

parent 8b8a201b
......@@ -67,6 +67,10 @@ public class GameTest {
final TrackingCard mutation = database.findTrackingCard(MUTATION.toString());
final SurvivalCard adrenaline = database.findSurvivalCard(ADRENALINE.toString());
final SurvivalCard alerte = database.findSurvivalCard(ALERTE.toString());
final SurvivalCard sacrifice = database.findSurvivalCard(SACRIFICE.toString());
final SurvivalCard vaccin = database.findSurvivalCard(VACCIN.toString());
final SurvivalCard sixieme_sens = database.findSurvivalCard(SIXIEME_SENS.toString());
final SurvivalCard riposte = database.findSurvivalCard(RIPOSTE.toString());
@BeforeEach
public void setUp() {
......@@ -86,7 +90,7 @@ public class GameTest {
}
@Test
public void testGameCollection_ErrorSup7() {
public void testGameCollection_moreThan7Players() {
Room room = mock(Room.class);
assertThrows(IllegalArgumentException.class, () -> new Game(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8), 1, planet, board, room));
}
......@@ -317,7 +321,6 @@ public class GameTest {
Game game = new Game(a, 1, planet, board, room);
game.getPlanet().forceMovePlanetPawn();
Board board = game.getBoard();
assertEquals(new Score(7, 13), board.getScore());
board.moveForwardTraque(11);
board.moveForwardCreature(6);
......@@ -363,10 +366,8 @@ public class GameTest {
.thenReturn(new ActionChoosePower(0));
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);
assertTrue(game.playerPlayCard(2, Collections.singletonList(plage)).state);
......@@ -379,39 +380,50 @@ public class GameTest {
assertFalse(game.creatureCanPlayThisTrackingCards(game.getCreature(), acharnement));
}
/* @Test
@Test
void testCanPlayMethods_True() throws TException {
Room room = mock(Room.class);
List<Pair<Integer, String>> a = new ArrayList(Arrays.asList(new Pair(1, "Nathan"), new Pair(2, "Odile")));
Game game = new Game(a, 1, planet, board, room);
game.getPlanet().forceMovePlanetPawn();
Board board = game.getBoard();
Room room = mock(Room.class);
List<Pair<Integer, String>> a = new ArrayList(Arrays.asList(new Pair(1, "Nathan"), new Pair(2, "Odile")));
Game game = new Game(a, 1, planet, board, room);
game.getPlanet().forceMovePlanetPawn();
Board board = game.getBoard();
game.getCreature().getTrackingCardHand().clear();
game.getCreature().getTrackingCardHand().add(acharnement);
game.getCreature().getTrackingCardHand().add(mutation);
game.getTraques().get(0).getSurvivalCardsHand().clear();
game.getTraques().get(0).getSurvivalCardsHand().add(vaccin);
game.getTraques().get(0).getSurvivalCardsHand().add(sixieme_sens);
assertEquals(new Score(7, 13), board.getScore());
board.moveForwardTraque(11);
board.moveForwardCreature(6);
assertEquals(new Score(1, 2), board.getScore());
when(room.askAction(any(Integer.class), any(TAskAction.class)))
.thenReturn(new ActionChoosePower(0));
assertEquals(new Score(7, 13), board.getScore());
board.moveForwardTraque(11);
board.moveForwardCreature(6);
assertEquals(new Score(1, 2), board.getScore());
when(room.askAction(any(Integer.class), any(TAskAction.class)))
.thenReturn(new ActionChoosePower(0));
assertTrue(game.traqueCanPlayThisSurvivalCards(game.getTraques().get(0), vaccin));
assertTrue(game.traqueCanPlayThisSurvivalCards(game.getTraques().get(0), sixieme_sens));
assertTrue(game.playerHasFinished(1, Phase.PREPHASE_1).state);
assertTrue(game.playerHasFinished(2, Phase.PREPHASE_1).state);
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);
assertTrue(game.playerPlayCard(2, Collections.singletonList(plage)).state);
assertTrue(game.playerHasFinished(2, Phase.PHASE_1).state);
assertTrue(game.playerHasFinished(1, Phase.PHASE_1).state);
assertTrue(game.playerPlayCard(2, Collections.singletonList(plage)).state);
assertTrue(game.playerHasFinished(1, Phase.POSTPHASE_1).state);
assertTrue(game.playerHasFinished(2, Phase.POSTPHASE_1).state);
assertTrue(game.creatureCanPlayThisTrackingCards(game.getCreature(), acharnement));
}*/
assertTrue(game.playerHasFinished(2, Phase.PHASE_1).state);
assertTrue(game.playerHasFinished(1, Phase.POSTPHASE_1).state);
assertTrue(game.playerHasFinished(2, Phase.POSTPHASE_1).state);
assertTrue(game.creatureCanPlayThisTrackingCards(game.getCreature(), acharnement));
assertTrue(game.creatureCanPlayThisTrackingCards(game.getCreature(), new ArrayList<TrackingCard>(Arrays.asList(acharnement, mutation))));
}
@Test
void testPlayerPlayCard() throws TException {
void testPlayerPlayCard_sendErrorMessage() throws TException {
Room room = mock(Room.class);
List<Pair<Integer, String>> a = new ArrayList(Arrays.asList(new Pair(1, "Nathan"), new Pair(2, "Odile")));
Game game = new Game(a, 1, planet, board, room);
......@@ -426,10 +438,8 @@ public class GameTest {
.thenReturn(new ActionChoosePower(0));
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);
assertTrue(game.playerPlayCard(2, Collections.singletonList(plage)).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