Add: PlayableCardTest, SlotTest

This commit is contained in:
2026-03-21 15:50:35 +01:00
parent 7e20248b7d
commit e0d4673c6e
2 changed files with 69 additions and 0 deletions
@@ -0,0 +1,34 @@
package it.polimi.ingsw.gc14.Model;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class PlayableCardTest {
@Test
void PlayableCardWrongEraException() {
assertDoesNotThrow(() -> {
new BuildingCard(1, 5);
});
assertDoesNotThrow(() -> {
new BuildingCard(2, 5);
});
assertDoesNotThrow(() -> {
new BuildingCard(3, 5);
});
assertThrows(IllegalArgumentException.class, () -> {
new BuildingCard(0, 5);
});
assertThrows(IllegalArgumentException.class, () -> {
new BuildingCard(4, 5);
});
assertThrows(IllegalArgumentException.class, () -> {
new BuildingCard(-1, 5);
});
}
}
@@ -0,0 +1,35 @@
package it.polimi.ingsw.gc14.Model;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class SlotTest {
@Test
void SlotWrongArgument() { // TODO: Cos'è il parametro nMinPlayer? come va testato?
assertDoesNotThrow(() -> {
Slot sl1 = new Slot(0,0,1,1);
});
assertDoesNotThrow(() -> {
Slot sl1 = new Slot(0,1,0,1);
});
assertDoesNotThrow(() -> {
Slot sl1 = new Slot(1,0,0,1);
});
assertDoesNotThrow(() -> {
Slot sl1 = new Slot(1,1,0,1);
});
assertThrows(IllegalArgumentException.class, () -> {
Slot sl1 = new Slot(1,0,1,1);
});
assertThrows(IllegalArgumentException.class, () -> {
Slot sl1 = new Slot(0,1,1,1);
});
assertThrows(IllegalArgumentException.class, () -> {
Slot sl1 = new Slot(1,1,1,1);
});
}
}