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

Merge remote-tracking branch 'origin/master'

parents 9522f17b 52c6a880
...@@ -169,7 +169,7 @@ public class HandTraque { ...@@ -169,7 +169,7 @@ public class HandTraque {
} }
public boolean addPlaceCardInDefausse(List<PlaceCard> cards){ public boolean addPlaceCardInDefausse(List<PlaceCard> cards){
return placeCards.add(cards); return placeCards.addInDefausse(cards);
} }
public boolean playPlaceCard(PlaceCard card){ public boolean playPlaceCard(PlaceCard card){
......
package fr.univnantes.alma.server.game.item.player.hand; package fr.univnantes.alma.server.game.item.player.hand;
import fr.univnantes.alma.server.game.item.Phase;
import fr.univnantes.alma.server.game.item.card.*;
import fr.univnantes.alma.server.game.item.card.SurvivalCard;
import fr.univnantes.alma.server.game.item.card.SurvivalCard;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertEquals;
class HandTraqueTest { class HandTraqueTest {
//TODO tests HandTraque hand = new HandTraque();
@Test
public void testAddSurvivalCardToApplied(){
SurvivalCard card = new SurvivalCard(CardName.ADRENALINE,"ADRENALINECard","yes adrenaline", Phase.PHASE_2);
hand.addSurvivalCardToApplied(card);
assertTrue(hand.getSurvivalCardsToApplied().contains(card));
}
@Test
public void testAddSurvivalCardToAppliedList(){
SurvivalCard card = new SurvivalCard(CardName.ADRENALINE,"ADRENALINECard","yes adrenaline", Phase.PHASE_2);
List<SurvivalCard> testCards= new ArrayList<>();
testCards.add(card);
hand.addSurvivalCardToApplied(testCards);
assertTrue(hand.getSurvivalCardsToApplied().containsAll(testCards));
}
@Test
public void testRemoveSurvivalCardToApplied(){
SurvivalCard card = new SurvivalCard(CardName.ADRENALINE,"ADRENALINECard","yes adrenaline", Phase.PHASE_2);
hand.addSurvivalCardToApplied(card);
hand.removeSurvivalCardToApplied(card);
assertFalse(hand.getSurvivalCardsToApplied().contains(card));
}
@Test
public void testRemoveSurvivalCardToAppliedList(){
SurvivalCard card = new SurvivalCard(CardName.ADRENALINE,"ADRENALINECard","yes adrenaline", Phase.PHASE_2);
List<SurvivalCard> testCards= new ArrayList<>();
testCards.add(card);
hand.addSurvivalCardToApplied(testCards);
hand.removeSurvivalCardToApplied(testCards);
assertFalse(hand.getSurvivalCardsToApplied().containsAll(testCards));
}
@Test
public void testGetSurvivalCardToApplied(){
assertEquals(hand.getSurvivalCardsToApplied(),new ArrayList<>());
}
/* PlaceCardDeck methods */
@Test
public void testSetPlaceCards() {
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
assertTrue(hand.getPlaceCards().containsAll(testCards));
}
@Test
public void testSetDefausse() {
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setDefausse(testCards);
assertTrue(hand.getDefausse().containsAll(testCards));
}
@Test
public void testPlaceCardHandSize(){
assertEquals(hand.placeCardHandSize(),0);
}
@Test
public void testPlaceCardIsEmpty(){
assertTrue(hand.placeCardIsEmpty());
}
@Test
public void testDefausseSize(){
assertEquals(hand.defausseSize(),0);
}
@Test
public void testDefausseIsEmpty(){
assertTrue(hand.defausseIsEmpty());
}
@Test
public void testPlaceCardPlayedSize(){
assertEquals(hand.placeCardPlayedSize(),0);
}
@Test
public void testPlaceCardPlayedIsEmpty(){
assertTrue(hand.placeCardPlayedIsEmpty());
}
@Test
public void testThrowAwayPlaceCard(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
hand.playPlaceCard(testCards);
assertTrue(hand.throwAwayPlaceCard());
assertTrue(hand.getDefausse().containsAll(testCards));
assertTrue(hand.getPlaceCardsPlayed().isEmpty());
}
@Test
public void testThrowAwayPlaceCardGiven(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
assertTrue(hand.throwAwayPlaceCard(card));
assertFalse(hand.getPlaceCards().contains(card));
assertTrue(hand.getDefausse().contains(card));
}
@Test
public void testThrowAwayPlaceCardList(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
assertTrue(hand.throwAwayPlaceCard(testCards));
assertTrue(hand.getDefausse().containsAll(testCards));
}
@Test
public void testTakeBackPlaceCardGiven(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
hand.throwAwayPlaceCard(card);
assertTrue(hand.takeBackPlaceCard(card));
assertTrue(hand.getPlaceCards().contains(card));
assertFalse(hand.getDefausse().contains(card));
}
@Test
public void testTakeBackPlaceCardList(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
hand.throwAwayPlaceCard(testCards);
assertTrue(hand.takeBackPlaceCard(testCards));
assertTrue(hand.getPlaceCards().containsAll(testCards));
}
@Test
public void testTakeBackPlayedPlaceCards(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
hand.playPlaceCard(testCards);
hand.takeBackPlayedPlaceCards();
assertTrue(hand.getPlaceCards().containsAll(testCards));
assertTrue(hand.getPlaceCardsPlayed().isEmpty());
}
@Test
public void testTakeBackAllPlaceCardFromDefausse(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.setPlaceCards(testCards);
hand.playPlaceCard(testCards);
hand.takeBackAllPlaceCardFromDefausse();
assertTrue(hand.getPlaceCards().containsAll(testCards));
assertTrue(hand.getDefausse().isEmpty());
}
@Test
public void testAddPlaceCard(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
assertTrue(hand.addPlaceCard(card));
assertTrue(hand.getPlaceCards().contains(card));
}
@Test
public void testAddPlaceCardList(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
assertTrue(hand.addPlaceCard(testCards));
assertTrue(hand.getPlaceCards().containsAll(testCards));
}
@Test
public void testAddPlaceCardInDefausse(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
assertTrue(hand.addPlaceCardInDefausse(card));
assertTrue(hand.getDefausse().contains(card));
}
@Test
public void testAddPlaceCardListInDefausse(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
assertTrue(hand.addPlaceCardInDefausse(testCards));
assertTrue(hand.getDefausse().containsAll(testCards));
}
@Test
public void testPlayPlaceCard(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
hand.addPlaceCard(card);
assertTrue(hand.playPlaceCard(card));
assertTrue(hand.getPlaceCardsPlayed().contains(card));
assertFalse(hand.getPlaceCards().contains(card));
}
@Test
public void testPlayPlaceCardList(){
PlaceCard card = new PlaceCard(CardName.ANTRE,"antre","antre",1,"url","bleu");
List<PlaceCard> testCards = new ArrayList<>();
testCards.add(card);
hand.addPlaceCard(testCards);
assertTrue(hand.playPlaceCard(testCards));
assertTrue(hand.getPlaceCardsPlayed().containsAll(testCards));
assertFalse(hand.getPlaceCards().containsAll(testCards));
}
/* SurvivalCards Methods */
@Test
public void testSurvivalCardHandSize(){
assertEquals(0,hand.survivalCardHandSize());
}
@Test
public void testSurvivalCardPlayedSize(){
assertEquals(0,hand.survivalCardPlayedSize());
}
@Test
public void testSurvivalCardHandIsEmpty(){
assertTrue(hand.survivalCardIsEmpty());
}
@Test
public void testSurvivalCardHandPlayedIsEmpty(){
assertTrue(hand.survivalCardPlayedIsEmpty());
}
@Test
public void testClearSurvivalCardPlayed(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
hand.addSurvivalCard(card);
hand.playSurvivalCard(card);
hand.clearSurvivalCardPlayed();
assertTrue(hand.survivalCardPlayedIsEmpty());
}
@Test
public void testAddSurvivalCard(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
hand.addSurvivalCard(card);
assertTrue(hand.getSurvivalCardsHand().contains(card));
}
@Test
public void testAddSurvivalCardList(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
List<SurvivalCard> testCards = new ArrayList<>();
testCards.add(card);
hand.addSurvivalCard(testCards);
assertTrue(hand.getSurvivalCardsHand().containsAll(testCards));
}
@Test
public void testRemoveSurvivalCard(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
hand.addSurvivalCard(card);
hand.removeSurvivalCard(card);
assertFalse(hand.getSurvivalCardsHand().contains(card));
}
@Test
public void testRemoveSurvivalCardList(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
List<SurvivalCard> testCards = new ArrayList<>();
testCards.add(card);
hand.addSurvivalCard(testCards);
hand.removeSurvivalCard(testCards);
assertFalse(hand.getSurvivalCardsHand().containsAll(testCards));
}
@Test
public void testPlaySurvivalCard(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
hand.addSurvivalCard(card);
assertTrue(hand.playSurvivalCard(card));
assertFalse(hand.getSurvivalCardsHand().contains(card));
assertTrue(hand.getSurvivalCardsPlayed().contains(card));
}
@Test
public void testPlaySurvivalCardList(){
SurvivalCard card = new SurvivalCard(CardName.INTERFERENCES,"InterferenceCard","The powers of the Beach and the Wreck are ineffective", Phase.PHASE_2);
List<SurvivalCard> testCards = new ArrayList<>();
testCards.add(card);
hand.addSurvivalCard(testCards);
assertTrue(hand.playSurvivalCard(testCards));
assertFalse(hand.getSurvivalCardsHand().containsAll(testCards));
assertTrue(hand.getSurvivalCardsPlayed().containsAll(testCards));
}
} }
\ No newline at end of file
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