Partial Test Cases For Sustenance Event Added
This commit is contained in:
@@ -19,7 +19,7 @@ public class Sustenance extends EventCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activateEvent (ArrayList <Player> playerList) {
|
public void activateEvent (ArrayList <Player> playerList) throws NullPointerException {
|
||||||
for(Player player : playerList){
|
for(Player player : playerList){
|
||||||
int NChar = player.getCharacterCards().size();
|
int NChar = player.getCharacterCards().size();
|
||||||
int NGatherers =
|
int NGatherers =
|
||||||
|
|||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user