Add: Added Missing Tests For Various Methods.
This commit is contained in:
@@ -13,8 +13,6 @@ class GathererTest {
|
||||
Gatherer g = new Gatherer(1);
|
||||
String s = g.toString();
|
||||
|
||||
System.out.println(s);
|
||||
|
||||
assertNotNull(s);
|
||||
assertFalse(s.contains(CharacterType.GATHERER.toString()));
|
||||
assertTrue(s.contains("⎕:"));
|
||||
|
||||
+2
-5
@@ -18,13 +18,10 @@ class HunterTest {
|
||||
@Test
|
||||
void testToString() {
|
||||
Hunter h = new Hunter(1, true);
|
||||
String s = h.toString();
|
||||
|
||||
assertNotNull(s);
|
||||
assertTrue(s.contains(" I"));
|
||||
assertTrue(h.toString().contains(" I"));
|
||||
|
||||
Hunter h2 = new Hunter(3, false);
|
||||
assertTrue(!h2.toString().contains("I"));
|
||||
assertFalse(h2.toString().contains("I"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+42
@@ -94,6 +94,36 @@ class CavePaintingsTest {
|
||||
assertEquals(7, p1.getFoodValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Not Building 9 test")
|
||||
void activateEvent3() {
|
||||
Player p1 = new Player("Marco");
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1));
|
||||
CavePaintings cp1 = new CavePaintings(1, 1, 3, 2);
|
||||
BuildingCard bc1 = new BuildingCard(9,1,5,5);
|
||||
p1.addFood(5);
|
||||
bc1.buy(p1);
|
||||
new Artist(1).insert(p1);
|
||||
cp1.activateEvent(players);
|
||||
|
||||
assertEquals(2, p1.getPrestigeValue());
|
||||
assertEquals(1 * 1, p1.getFoodValue());
|
||||
|
||||
p1.removeFood(p1.getFoodValue());
|
||||
|
||||
BuildingCard bc2 = new BuildingCard(7,1,5,5);
|
||||
BuildingCard bc3 = new BuildingCard(9,1,5,5);
|
||||
p1.addFood(10);
|
||||
bc2.buy(p1);
|
||||
bc3.buy(p1);
|
||||
new Artist(1).insert(p1);
|
||||
new Artist(1).insert(p1);
|
||||
cp1.activateEvent(players);
|
||||
|
||||
assertEquals(8, p1.getPrestigeValue());
|
||||
assertEquals(2 * 3, p1.getFoodValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Clone testing")
|
||||
void cloneTest() {
|
||||
@@ -113,4 +143,16 @@ class CavePaintingsTest {
|
||||
|
||||
assertEquals("⎕:(Event)CAVE_PAINTINGS", cv1.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("ToStringBoard testing")
|
||||
void toStringBoardTest() {
|
||||
int Era = 1;
|
||||
int NLower = 1;
|
||||
int NPrestigeRem = 2;
|
||||
int NPrestigeMul = 3;
|
||||
CavePaintings cv1 = new CavePaintings(Era, NLower,NPrestigeRem,NPrestigeMul);
|
||||
|
||||
assertEquals("⎕:(Event)" + cv1.getType() + " 0-"+(NLower-1)+":"+NPrestigeRem+" "+NLower+"+:"+NPrestigeMul, cv1.toStringBoard());
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,38 @@ class HuntTest {
|
||||
assertEquals(1, p3.getFoodValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("p2 doesnt have building 7")
|
||||
void activateEvent4() {
|
||||
Player p1 = new Player("Giacomo");
|
||||
Player p2 = new Player("xiaomi");
|
||||
Player p3 = new Player("test");
|
||||
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1, p2, p3));
|
||||
Hunt h1 = new Hunt(1, 3);
|
||||
|
||||
assertEquals(0, p1.getFoodValue());
|
||||
|
||||
new Hunter(1, true).insert(p1);
|
||||
new Hunter(1, false).insert(p1);
|
||||
new Hunter(1, false).insert(p2);
|
||||
new Hunter(1, false).insert(p2);
|
||||
|
||||
assertEquals(0, p2.getFoodValue());
|
||||
assertEquals(0, p2.getPrestigeValue());
|
||||
|
||||
new Hunter(1, false).insert(p3);
|
||||
assertEquals(0, p3.getFoodValue());
|
||||
|
||||
h1.activateEvent(players);
|
||||
assertEquals(3*2, p1.getPrestigeValue());
|
||||
assertEquals(1 + 2, p1.getFoodValue());
|
||||
assertEquals(3 * 2, p2.getPrestigeValue());
|
||||
assertEquals(2, p2.getFoodValue());
|
||||
assertEquals(3, p3.getPrestigeValue());
|
||||
assertEquals(1, p3.getFoodValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("clone testing")
|
||||
void cloneTest() {
|
||||
@@ -120,4 +152,14 @@ class HuntTest {
|
||||
|
||||
assertEquals("⎕:(Event)HUNT", h1.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("ToStringBoard testing")
|
||||
void toStringBoardTest() {
|
||||
int Era = 1;
|
||||
int prestigeMultiplier = 3;
|
||||
Hunt cv1 = new Hunt(Era, prestigeMultiplier);
|
||||
|
||||
assertEquals("⎕:(Event)" + cv1.getType() + " 1F+" + prestigeMultiplier + "PP" + " X N Hunter", cv1.toStringBoard());
|
||||
}
|
||||
}
|
||||
+34
@@ -190,6 +190,29 @@ class ShamanicRitualTest {
|
||||
assertEquals(-5, p3.getPrestigeValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("p1 does not have building 6")
|
||||
void ApplyEvent6() {
|
||||
Player p1 = new Player("Marco");
|
||||
Player p2 = new Player("Luca");
|
||||
|
||||
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1, p2));
|
||||
|
||||
new Shaman(1, 3).insert(p1);
|
||||
new Shaman(1, 1).insert(p2);
|
||||
|
||||
BuildingCard b = new BuildingCard(2, 1, 5, 1);
|
||||
p1.addFood(5);
|
||||
b.buy(p1);
|
||||
|
||||
ShamanicRitual ritual = new ShamanicRitual(1, 10, 5);
|
||||
ritual.activateEvent(players);
|
||||
|
||||
assertEquals(10, p1.getPrestigeValue());
|
||||
assertEquals(-5, p2.getPrestigeValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Clone testing")
|
||||
void cloneTest() {
|
||||
@@ -214,4 +237,15 @@ class ShamanicRitualTest {
|
||||
|
||||
assertEquals("⎕:(Event)SHAMANIC_RITUAL", sr1.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("ToStringBoard testing")
|
||||
void toStringBoardTest() {
|
||||
int Era = 1;
|
||||
int prestigeToAdd = 1;
|
||||
int prestigeToRem = 2;
|
||||
ShamanicRitual cv1 = new ShamanicRitual(Era, prestigeToAdd, prestigeToRem);
|
||||
|
||||
assertEquals("⎕:(Event)" + cv1.getType() + " *>:" + prestigeToAdd + " *<:" + prestigeToRem, cv1.toStringBoard());
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,39 @@ class SustenanceTest {
|
||||
assertEquals(0, p2.getPrestigeValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Missing Building 1 testing")
|
||||
void activateEvent3() {
|
||||
Player p1 = new Player("marco");
|
||||
Player p2 = new Player("giacomo");
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1,p2));
|
||||
|
||||
p1.addFood(5);
|
||||
new Inventor(1, 1).insert(p1);
|
||||
new Shaman(1, 5).insert(p1);
|
||||
new Builder(1, 5, 5).insert(p1);
|
||||
new Artist(1).insert(p1);
|
||||
new Hunter(1, false).insert(p1);
|
||||
new Gatherer(1).insert(p1);
|
||||
|
||||
p2.addFood(2);
|
||||
new Artist(1).insert(p2);
|
||||
new Artist(1).insert(p2);
|
||||
new Artist(1).insert(p2);
|
||||
|
||||
|
||||
Building1 bd2 = new Building1(1, 1, 1, CharacterType.ARTIST);
|
||||
|
||||
bd2.buy(p2);
|
||||
|
||||
Sustenance s = new Sustenance(1,2);
|
||||
s.activateEvent(players);
|
||||
assertEquals(2, p1.getFoodValue());
|
||||
assertEquals(1, p2.getFoodValue());
|
||||
assertEquals(0, p1.getPrestigeValue());
|
||||
assertEquals(0, p2.getPrestigeValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Clone testing")
|
||||
void cloneTest() {
|
||||
@@ -124,6 +157,16 @@ class SustenanceTest {
|
||||
|
||||
assertEquals("⎕:(Event)SUSTENANCE", s1.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("ToStringBoard testing")
|
||||
void toStringBoardTest() {
|
||||
int Era = 3;
|
||||
int prestigeDebt = 15;
|
||||
Sustenance cv1 = new Sustenance(Era, prestigeDebt);
|
||||
|
||||
assertEquals("⎕:(Event)" + cv1.getType() + " -1F/-" + prestigeDebt + "PP", cv1.toStringBoard());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user