Partial Test Cases For Sustenance Event Added

This commit is contained in:
GabrieleRadice
2026-03-15 20:08:53 +01:00
parent f3418b8aee
commit 6c88e07aeb
2 changed files with 40 additions and 1 deletions
@@ -0,0 +1,39 @@
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
import it.polimi.ingsw.gc14.Model.Player;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
class SustenanceTest {
@Test
@DisplayName("Exception Test Null List")
void test_null() {
ArrayList<Player> p = null;
Sustenance s = new Sustenance(0,0);
assertThrows(NullPointerException.class, () -> {
s.activateEvent(p);
});
}
// TODO
// Mancano i metodi di play, il player non ha carte e non può giocare al momento
@Test
void activateEvent() {
Player p1 = new Player("p1");
Player p2 = new Player("p2");
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1,p2));
Sustenance s = new Sustenance(0,1);
s.activateEvent(players);
assertEquals(0, p1.getFoodValue());
assertEquals(0, p2.getFoodValue());
assertEquals(0, p1.getPrestigeValue());
assertEquals(0, p2.getPrestigeValue());
}
}