Fix:Building11Test - refactoring of test names

This commit is contained in:
2026-03-20 19:00:03 +01:00
parent 3e7d97916e
commit 336a9aedc2
@@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.*;
class Building11Test { class Building11Test {
@Test @Test
void applyEffect() { void applyEffectBuyWithoutFood() {
Player p1 = new Player("Xiaomi"); Player p1 = new Player("Xiaomi");
Building11 b1 = new Building11(2, 10, ARTIST, -3); Building11 b1 = new Building11(2, 10, ARTIST, -3);
@@ -28,8 +28,10 @@ class Building11Test {
b1.buy(p1); b1.buy(p1);
b1.applyEffect(p1); b1.applyEffect(p1);
assertEquals(-3, p1.getPrestigeValue()); assertEquals(-3, p1.getPrestigeValue());
}
@Test
void applyEffectWithTwoCards() {
Player p2 = new Player("Giacomo"); Player p2 = new Player("Giacomo");
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);
@@ -42,21 +44,26 @@ class Building11Test {
b2.applyEffect(p2); b2.applyEffect(p2);
assertEquals(8, p2.getPrestigeValue()); assertEquals(8, p2.getPrestigeValue());
}
@Test
void applyEffectTwoPlayersBuyTheSameCard() {
Player p3 = new Player("AAAAAAAAAA");
Player p4 = new Player("BBBBBBBBBB");
Building11 b3 = new Building11(1, 15, HUNTER, 5); Building11 b3 = new Building11(1, 15, HUNTER, 5);
p1.addFood(b3.getPrice()); p3.addFood(b3.getPrice());
assertTrue(b3.buy(p1)); assertTrue(b3.buy(p3));
b3.buy(p1); p4.addFood(b3.getPrice());
p2.addFood(b3.getPrice()); assertEquals(false, b3.buy(p4));
assertEquals(false, b3.buy(p2)); }
@Test
void applyEffectApplyEffectWithoutBuyingFirst() {
Player p5 = new Player("DRTFGBHJN");
Building11 b4 = new Building11(3, 10, ARTIST, 4); Building11 b4 = new Building11(3, 10, ARTIST, 4);
assertThrows(IllegalArgumentException.class, () -> { assertThrows(IllegalArgumentException.class, () -> {
b4.applyEffect(p1); b4.applyEffect(p5);
}); });
} }
} }