@@ -1,7 +1,10 @@
|
|||||||
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
|
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
|
||||||
|
|
||||||
|
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||||
|
import it.polimi.ingsw.gc14.Model.Cards.Building.Effects.Building0;
|
||||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Hunter;
|
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Hunter;
|
||||||
import it.polimi.ingsw.gc14.Model.Player;
|
import it.polimi.ingsw.gc14.Model.Player;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -10,24 +13,26 @@ import java.util.Arrays;
|
|||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class HuntTest {
|
class HuntTest {
|
||||||
|
@Test
|
||||||
|
@DisplayName("Testing constructor")
|
||||||
|
void testConstructor() {
|
||||||
|
// Gli attributi di Hunt era e EventType vengono testati in EventCardTest.
|
||||||
|
|
||||||
|
// Gli attributi foodToAdd e prestigeMultiplier non possono essere testati singolarmente in quanto non hanno metodi getter
|
||||||
|
// Ne viene testato il corretto funzionamento indirettamente attraverso applyEffect.
|
||||||
|
|
||||||
|
// Come conseguenza finale, non può essere testato il costruttore di Hunt
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@DisplayName("No edge case test")
|
||||||
void activateEvent() {
|
void activateEvent() {
|
||||||
Player p1 = new Player("Giacomo");
|
Player p1 = new Player("Giacomo");
|
||||||
Player p2 = new Player("xiaomi");
|
Player p2 = new Player("xiaomi");
|
||||||
|
|
||||||
|
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1, p2));
|
||||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1,p2));
|
|
||||||
Hunt h1 = new Hunt(1, 3);
|
Hunt h1 = new Hunt(1, 3);
|
||||||
h1.activateEvent(players);
|
|
||||||
|
|
||||||
assertEquals(0, p1.getPrestigeValue());
|
|
||||||
assertEquals(1, p1.getFoodValue());
|
|
||||||
assertEquals(0, p2.getPrestigeValue());
|
|
||||||
assertEquals(1, p2.getFoodValue());
|
|
||||||
|
|
||||||
|
|
||||||
Hunt h2 = new Hunt(1, 3);
|
|
||||||
Hunter hunter1 = new Hunter(1, true);
|
Hunter hunter1 = new Hunter(1, true);
|
||||||
Hunter hunter2 = new Hunter(1, false);
|
Hunter hunter2 = new Hunter(1, false);
|
||||||
p1.hunters.add(hunter1);
|
p1.hunters.add(hunter1);
|
||||||
@@ -36,14 +41,50 @@ class HuntTest {
|
|||||||
Hunter hunter3 = new Hunter(1, false);
|
Hunter hunter3 = new Hunter(1, false);
|
||||||
p2.hunters.add(hunter3);
|
p2.hunters.add(hunter3);
|
||||||
|
|
||||||
h2.activateEvent(players);
|
h1.activateEvent(players);
|
||||||
assertEquals(6, p1.getPrestigeValue());
|
assertEquals(6, p1.getPrestigeValue());
|
||||||
assertEquals(2, p1.getFoodValue());
|
assertEquals(1, p1.getFoodValue());
|
||||||
assertEquals(3, p2.getPrestigeValue());
|
assertEquals(3, p2.getPrestigeValue());
|
||||||
|
assertEquals(1, p2.getFoodValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("no Hunters test")
|
||||||
|
void activateEvent2() {
|
||||||
|
Player p1 = new Player("Giacomo");
|
||||||
|
Player p2 = new Player("xiaomi");
|
||||||
|
|
||||||
|
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1, p2));
|
||||||
|
Hunt h1 = new Hunt(1, 3);
|
||||||
|
h1.activateEvent(players);
|
||||||
|
|
||||||
|
assertEquals(0, p1.getPrestigeValue());
|
||||||
|
assertEquals(1, p1.getFoodValue());
|
||||||
|
assertEquals(0, p2.getPrestigeValue());
|
||||||
|
assertEquals(1, p2.getFoodValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("No edge case test")
|
||||||
|
void activateEvent3() {
|
||||||
|
Player p1 = new Player("Giacomo");
|
||||||
|
Player p2 = new Player("xiaomi");
|
||||||
|
|
||||||
|
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1, p2));
|
||||||
|
Hunt h1 = new Hunt(1, 3);
|
||||||
|
|
||||||
|
Hunter hunter1 = new Hunter(1, true);
|
||||||
|
Hunter hunter2 = new Hunter(1, false);
|
||||||
|
p1.hunters.add(hunter1);
|
||||||
|
p1.hunters.add(hunter2);
|
||||||
|
|
||||||
|
Hunter hunter3 = new Hunter(1, false);
|
||||||
|
p2.hunters.add(hunter3);
|
||||||
|
|
||||||
|
h1.activateEvent(players);
|
||||||
|
assertEquals(6, p1.getPrestigeValue());
|
||||||
|
assertEquals(1, p1.getFoodValue());
|
||||||
assertEquals(3, p2.getPrestigeValue());
|
assertEquals(3, p2.getPrestigeValue());
|
||||||
assertEquals(2, p2.getFoodValue());
|
assertEquals(1, p2.getFoodValue());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user