Add: Added applyEffect Method Test In BuildingCardTest.java.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Model.Cards;
|
||||
|
||||
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.Building.Effects.Building13;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
@@ -145,9 +144,9 @@ class BuildingCardTest {
|
||||
|
||||
BuildingCard bc0 = new BuildingCard(2, 1,1,1);
|
||||
|
||||
assertEquals(true, bc0.buy(p1));
|
||||
assertEquals(false, bc0.buy(p1));
|
||||
assertEquals(false, bc0.buy(p2));
|
||||
assertTrue(bc0.buy(p1));
|
||||
assertFalse(bc0.buy(p1));
|
||||
assertFalse(bc0.buy(p2));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -157,4 +156,35 @@ class BuildingCardTest {
|
||||
|
||||
assertEquals("Era:1\nPrice:2\nPrestige:3\n", b0.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Apply Effect")
|
||||
void applyEffect(){
|
||||
String user = "test";
|
||||
Player p = new Player(user);
|
||||
assertTrue(p.buildingCards.isEmpty());
|
||||
assertTrue(p.inventors.isEmpty());
|
||||
assertTrue(p.builders.isEmpty());
|
||||
assertTrue(p.gatherers.isEmpty());
|
||||
assertTrue(p.shamans.isEmpty());
|
||||
assertTrue(p.hunters.isEmpty());
|
||||
assertTrue(p.artists.isEmpty());
|
||||
assertEquals(0, p.getFoodValue());
|
||||
assertEquals(0, p.getPrestigeValue());
|
||||
assertEquals(user, p.getUserName());
|
||||
|
||||
BuildingCard b = new BuildingCard(1,2,3);
|
||||
b.applyEffect(p);
|
||||
|
||||
assertTrue(p.buildingCards.isEmpty());
|
||||
assertTrue(p.inventors.isEmpty());
|
||||
assertTrue(p.builders.isEmpty());
|
||||
assertTrue(p.gatherers.isEmpty());
|
||||
assertTrue(p.shamans.isEmpty());
|
||||
assertTrue(p.hunters.isEmpty());
|
||||
assertTrue(p.artists.isEmpty());
|
||||
assertEquals(0, p.getFoodValue());
|
||||
assertEquals(0, p.getPrestigeValue());
|
||||
assertEquals(user, p.getUserName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user