Add: Added Tests About Exception Handling In Builiding0Test
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user