Fix: Building11Test Correctly Handles Buying Of BuildingCards
This commit is contained in:
@@ -18,12 +18,14 @@ class Building11Test {
|
|||||||
Building11 b1 = new Building11(2, 10, ARTIST, -3);
|
Building11 b1 = new Building11(2, 10, ARTIST, -3);
|
||||||
Artist a1 = new Artist(2);
|
Artist a1 = new Artist(2);
|
||||||
b1.buy(p1);
|
b1.buy(p1);
|
||||||
|
assertFalse(b1.buy(p1));
|
||||||
p1.artists.add(a1);
|
p1.artists.add(a1);
|
||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> {
|
assertThrows(IllegalArgumentException.class, () -> {
|
||||||
b1.applyEffect(p1);
|
b1.applyEffect(p1);
|
||||||
});
|
});
|
||||||
p1.buildingCards.add(b1);
|
p1.addFood(b1.getPrice());
|
||||||
|
b1.buy(p1);
|
||||||
b1.applyEffect(p1);
|
b1.applyEffect(p1);
|
||||||
assertEquals(-3, p1.getPrestigeValue());
|
assertEquals(-3, p1.getPrestigeValue());
|
||||||
|
|
||||||
@@ -32,20 +34,21 @@ class Building11Test {
|
|||||||
Building11 b2 = new Building11(2, 10, ARTIST, 4);
|
Building11 b2 = new Building11(2, 10, ARTIST, 4);
|
||||||
Artist a2 = new Artist(2);
|
Artist a2 = new Artist(2);
|
||||||
Artist a3 = new Artist(2);
|
Artist a3 = new Artist(2);
|
||||||
|
p2.addFood(b2.getPrice());
|
||||||
b2.buy(p2);
|
b2.buy(p2);
|
||||||
p2.artists.add(a2);
|
p2.artists.add(a2);
|
||||||
p2.artists.add(a3);
|
p2.artists.add(a3);
|
||||||
|
|
||||||
p2.buildingCards.add(b2);
|
|
||||||
b2.applyEffect(p2);
|
b2.applyEffect(p2);
|
||||||
assertEquals(8, p2.getPrestigeValue());
|
assertEquals(8, p2.getPrestigeValue());
|
||||||
|
|
||||||
|
|
||||||
Building11 b3 = new Building11(1, 15, HUNTER, 5);
|
Building11 b3 = new Building11(1, 15, HUNTER, 5);
|
||||||
|
p1.addFood(b3.getPrice());
|
||||||
|
assertTrue(b3.buy(p1));
|
||||||
b3.buy(p1);
|
b3.buy(p1);
|
||||||
|
p2.addFood(b3.getPrice());
|
||||||
assertEquals(false, b3.buy(p2));
|
assertEquals(false, b3.buy(p2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user