Add: Added Tests About Exception Handling In Builiding0Test

This commit is contained in:
GabrieleRadice
2026-03-20 19:02:54 +01:00
parent 336a9aedc2
commit d80c2888ee
@@ -66,4 +66,26 @@ class Building0Test {
b0.applyEffect(p);
assertEquals(0, p.getFoodValue());
}
@Test
@DisplayName("Exception Test")
void applyEffect3() {
assertThrows(IllegalArgumentException.class, () -> {
Building0 b0 = new Building0(1, 1);
Player p = new Player("test");
b0.applyEffect(p);
});
}
@Test
@DisplayName("Buying Of Same Card By Two Different Players")
void applyEffect4() {
Building0 b0 = new Building0(1, 1);
Player p1 = new Player("test1");
Player p2 = new Player("test2");
p1.addFood(b0.getPrice());
p2.addFood(b0.getPrice());
b0.buy(p1);
assertFalse(b0.buy(p2));
}
}