Fix: HuntTest
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
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.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -12,10 +15,45 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
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
|
||||
@DisplayName("No edge case test")
|
||||
void activateEvent() {
|
||||
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(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);
|
||||
@@ -25,9 +63,17 @@ class HuntTest {
|
||||
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);
|
||||
|
||||
Hunt h2 = new Hunt(1, 3);
|
||||
Hunter hunter1 = new Hunter(1, true);
|
||||
Hunter hunter2 = new Hunter(1, false);
|
||||
p1.hunters.add(hunter1);
|
||||
@@ -36,14 +82,10 @@ class HuntTest {
|
||||
Hunter hunter3 = new Hunter(1, false);
|
||||
p2.hunters.add(hunter3);
|
||||
|
||||
h2.activateEvent(players);
|
||||
h1.activateEvent(players);
|
||||
assertEquals(6, p1.getPrestigeValue());
|
||||
assertEquals(2, p1.getFoodValue());
|
||||
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