Initial problem solving (identified by Intellij)
This commit is contained in:
@@ -64,7 +64,7 @@ class Building1Test {
|
||||
|
||||
BuildingCard bClone = b0.clone();
|
||||
|
||||
assertTrue(bClone instanceof Building1);
|
||||
assertInstanceOf(Building1.class, bClone);
|
||||
|
||||
Building1 clonedBuilding = (Building1) bClone;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Model.Cards;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.Effects.Building13;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Builder;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
|
||||
+4
-14
@@ -9,22 +9,12 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class CavePaintingsTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("Testing constructor")
|
||||
void testConstructor() {
|
||||
// Gli attributi di CavePainting era e EventType vengono testati in EventCardTest.
|
||||
|
||||
// Gli attributi NLower, NPrestigeRem e NPrestigeMul non possono essere testati singolarmente in quanto non hanno metodi getter
|
||||
// Ne viene testato il corretto funzionamento indirettamente attraverso applyEffect.
|
||||
|
||||
// Come conseguenza finale, non può essere testato il costruttore di CavePainting
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("No edge case test")
|
||||
void activateEvent() {
|
||||
@@ -46,7 +36,7 @@ class CavePaintingsTest {
|
||||
@DisplayName("Multiple activations test")
|
||||
void activateEvent1() {
|
||||
Player p1 = new Player("Marco");
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1));
|
||||
ArrayList<Player> players = new ArrayList<>(List.of(p1));
|
||||
CavePaintings cp1 = new CavePaintings(1, 1, 3, 2);
|
||||
CavePaintings cp2 = new CavePaintings(1, 1, 3, 4);
|
||||
CavePaintings cp3 = new CavePaintings(1, 1, 10, 2);
|
||||
@@ -71,7 +61,7 @@ class CavePaintingsTest {
|
||||
@DisplayName("Building 9 test")
|
||||
void activateEvent2() {
|
||||
Player p1 = new Player("Marco");
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1));
|
||||
ArrayList<Player> players = new ArrayList<>(List.of(p1));
|
||||
CavePaintings cp1 = new CavePaintings(1, 1, 3, 2);
|
||||
BuildingCard bc1 = new BuildingCard(9,1,5,5);
|
||||
p1.addFood(5);
|
||||
@@ -98,7 +88,7 @@ class CavePaintingsTest {
|
||||
@DisplayName("Not Building 9 test")
|
||||
void activateEvent3() {
|
||||
Player p1 = new Player("Marco");
|
||||
ArrayList<Player> players = new ArrayList<>(Arrays.asList(p1));
|
||||
ArrayList<Player> players = new ArrayList<>(List.of(p1));
|
||||
CavePaintings cp1 = new CavePaintings(1, 1, 3, 2);
|
||||
BuildingCard bc1 = new BuildingCard(9,1,5,5);
|
||||
p1.addFood(5);
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.Effects.Building0;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Hunter;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
@@ -16,16 +13,6 @@ import java.util.Arrays;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class HuntTest {
|
||||
@Test
|
||||
@DisplayName("Testing constructor")
|
||||
void testConstructor() {
|
||||
// Gli attributi di Hunt era e EventType vengono testati in EventCardTest.
|
||||
|
||||
// Gli attributi foodMultiplier e prestigeMultiplier non possono essere testati singolarmente in quanto non hanno metodi getter
|
||||
// Ne viene testato il corretto funzionamento indirettamente attraverso applyEffect.
|
||||
|
||||
// Come conseguenza finale, non può essere testato il costruttore di Hunt
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("No edge case test")
|
||||
@@ -139,7 +126,6 @@ class HuntTest {
|
||||
Hunt h1 = new Hunt(era, prestigeMultiplier);
|
||||
Hunt h2 = (Hunt) h1.clone();
|
||||
|
||||
assertEquals(1, 1); // foodMultiplier is now a constant BASE_FOOD_PER_HUNTER=1
|
||||
assertEquals(3, h2.getPrestigeMultiplier());
|
||||
assertEquals(1, h2.getEra());
|
||||
assertEquals(EventType.HUNT, h2.getType());
|
||||
|
||||
-18
@@ -1,15 +1,10 @@
|
||||
package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Shaman;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventType;
|
||||
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.*;
|
||||
|
||||
@@ -18,21 +13,8 @@ import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class ShamanicRitualTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("Testing constructor")
|
||||
void testConstructor() {
|
||||
// Gli attributi di ShamanicRitual era e EventType vengono testati in EventCardTest.
|
||||
|
||||
// Gli attributi prestigeToAdd e prestigeToRemove non possono essere testati singolarmente in quanto non hanno metodi getter
|
||||
// Ne viene testato il corretto funzionamento indirettamente attraverso applyEffect.
|
||||
|
||||
// Come conseguenza finale, non può essere testato il costruttore di ShamanicRitual
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("No edge case test")
|
||||
void applyEvent() {
|
||||
|
||||
@@ -12,7 +12,6 @@ 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 {
|
||||
|
||||
|
||||
@@ -3,14 +3,10 @@ package it.polimi.ingsw.gc14.Model.GamePackage;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
|
||||
import it.polimi.ingsw.gc14.Model.DecksCreator;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Slot;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@@ -188,7 +184,7 @@ class BoardTest {
|
||||
void nextRound() {
|
||||
int numPlayer = 3;
|
||||
Board bd = new Board(numPlayer);
|
||||
assertTrue(!bd.getLowerListTribe().isEmpty());
|
||||
assertFalse(bd.getLowerListTribe().isEmpty());
|
||||
List<TribeCard> upperListBefore = new ArrayList<>(bd.getUpperListTribe());
|
||||
|
||||
bd.nextRound();
|
||||
|
||||
@@ -5,7 +5,6 @@ import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@@ -32,7 +31,7 @@ class Order2Test {
|
||||
Order2 order = new Order2(players);
|
||||
|
||||
Player firstToAct = order.pull();
|
||||
Player secondToAct = order.pull();
|
||||
order.pull();
|
||||
|
||||
int initialFood = firstToAct.getFoodValue();
|
||||
order.push(firstToAct);
|
||||
@@ -193,7 +192,7 @@ class Order2Test {
|
||||
assertTrue(order.toString().contains("+1🍖"));
|
||||
assertTrue(order.toString().contains("-1🍖/-2🏅"));
|
||||
|
||||
Player extraPlayer = new Player("px");
|
||||
new Player("px");
|
||||
//TODO testare IndexOutOfBoundsException
|
||||
// assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
// Order2 ox = new Order2(new ArrayList<>(Arrays.asList(p1, p2)));;
|
||||
|
||||
@@ -5,7 +5,6 @@ import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@@ -5,7 +5,6 @@ import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@@ -3,17 +3,10 @@ package it.polimi.ingsw.gc14.Model.Orders;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@@ -344,7 +337,7 @@ class Order5Test {
|
||||
assertNotEquals(thirdOut, fifthOut);
|
||||
assertNotEquals(fourthOut, fifthOut);
|
||||
|
||||
assertEquals(null, order.pull());
|
||||
assertNull(order.pull());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -355,11 +348,11 @@ class Order5Test {
|
||||
Player p4 = new Player("p4");
|
||||
Player p5 = new Player("p5");
|
||||
Order5 order = new Order5(new ArrayList<>(Arrays.asList(p1,p2,p3,p4,p5)));
|
||||
Player firstOut = order.pull();
|
||||
Player secondOut = order.pull();
|
||||
Player thirdOut = order.pull();
|
||||
Player fourthOut = order.pull();
|
||||
Player fifthOut = order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
order.pull();
|
||||
assertNull(order.getFirst());
|
||||
|
||||
order.push(p1);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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.*;
|
||||
|
||||
@@ -125,9 +125,9 @@ class PlayerTest {
|
||||
@Test
|
||||
void removeFood() {
|
||||
Player p = new Player("test");
|
||||
assertEquals(true, p.removeFood(0));
|
||||
assertEquals(false, p.removeFood(1));
|
||||
assertEquals(true, p.removeFood(-1));
|
||||
assertTrue(p.removeFood(0));
|
||||
assertFalse(p.removeFood(1));
|
||||
assertTrue(p.removeFood(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -183,7 +183,7 @@ class PlayerTest {
|
||||
@DisplayName("Exception Test Max Length")
|
||||
void test_max() {
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
Player p = new Player("abcdabcdabcdabcdabcdabcdabcdabcdZ");
|
||||
new Player("abcdabcdabcdabcdabcdabcdabcdabcdZ");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ class PlayerTest {
|
||||
@DisplayName("Exception Test Min Length")
|
||||
void test_min() {
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
Player p = new Player("");
|
||||
new Player("");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,29 +9,29 @@ class SlotTest {
|
||||
@Test
|
||||
void SlotWrongArgument() {
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('A');
|
||||
new Slot('A');
|
||||
});
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('B');
|
||||
new Slot('B');
|
||||
});
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('C');
|
||||
new Slot('C');
|
||||
});
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('D');
|
||||
new Slot('D');
|
||||
});
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('E');
|
||||
new Slot('E');
|
||||
});
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('F');
|
||||
new Slot('F');
|
||||
});
|
||||
assertDoesNotThrow(() -> {
|
||||
Slot sl1 = new Slot('G');
|
||||
new Slot('G');
|
||||
});
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
Slot sl1 = new Slot('H');
|
||||
new Slot('H');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user