|
|
|
@@ -3,311 +3,378 @@ package uppa.project.pojo;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
|
|
class GameTest {
|
|
|
|
|
|
|
|
|
|
static Game[] FIXTURE;
|
|
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
|
void setUp() {
|
|
|
|
|
FIXTURE = new Game[] {
|
|
|
|
|
new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 3,6, new ArrayList<Player>()),
|
|
|
|
|
new Game(new BigDecimal(2), new Date(2024,3,26), Game.Difficulty.HARD, 52, 4,13, new ArrayList<Player>()),
|
|
|
|
|
new Game(new BigDecimal(3), new Date(2023,9,18), Game.Difficulty.EASY, 5, 2,10, new ArrayList<Player>()),
|
|
|
|
|
};
|
|
|
|
|
Player[] players = new Player[]{
|
|
|
|
|
new Player(new BigDecimal(1), FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE),5, true, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(2), FIXTURE[1], new User("username2", "email2", "password2", new Date(1996, 4, 7), User.Gender.MALE),34, false, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(3), FIXTURE[2], new User("username3", "email3", "password3", new Date(1996, 4, 7), User.Gender.MALE),22, false, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(4), FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE),68, true, 7,7,7),
|
|
|
|
|
};
|
|
|
|
|
FIXTURE[0].addPlayer(players[0]);
|
|
|
|
|
FIXTURE[0].addPlayer(players[3]);
|
|
|
|
|
FIXTURE[1].addPlayer(players[1]);
|
|
|
|
|
FIXTURE[2].addPlayer(players[2]);
|
|
|
|
|
@Test
|
|
|
|
|
void test_constructor() {
|
|
|
|
|
new Game();
|
|
|
|
|
new Game(Game.Difficulty.EASY, 17, 3,6);
|
|
|
|
|
new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 3,6, new ArrayList<Player>());
|
|
|
|
|
new Game(new BigDecimal(2), new Date(2024,3,26), Game.Difficulty.HARD, 52, 4,13, new ArrayList<Player>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void error_if_invalid_nbrounds() {
|
|
|
|
|
//In constructor
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 0, 3,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, -1, 3,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, -5, 3,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 19, 3,6, new ArrayList<Player>()));
|
|
|
|
|
|
|
|
|
|
//In setter
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
Game game = FIXTURE[i];
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbRounds(0));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbRounds(-1));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbRounds(-5));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbRounds(19));
|
|
|
|
|
void test_constructor_throwIllegalArgumentExceptionOnInvalidValues(){
|
|
|
|
|
int[] INCORRECT_VALUES = {Integer.MIN_VALUE, -2, 0, 14, Integer.MAX_VALUE};
|
|
|
|
|
for (int incorrect_value : INCORRECT_VALUES) {
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(Game.Difficulty.EASY,4*incorrect_value,4, incorrect_value));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void error_if_invalid_nbColors() {
|
|
|
|
|
//In constructor
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 0,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, -1,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, -5,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 5,6, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 17,6, new ArrayList<Player>()));
|
|
|
|
|
|
|
|
|
|
//In setter
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
Game game = FIXTURE[i];
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbColors(0));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbColors(-1));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbColors(-5));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbColors(5));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbColors(17));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void error_if_invalid_nbValuesPerColor() {
|
|
|
|
|
//In constructor
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 3,0, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 3,-1, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 3,-5, new ArrayList<Player>()));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(new BigDecimal(1), new Date(2023,12,25), Game.Difficulty.EASY, 17, 3,14, new ArrayList<Player>()));
|
|
|
|
|
|
|
|
|
|
//In setter
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
Game game = FIXTURE[i];
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbValuesPerColor(0));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbValuesPerColor(-1));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbValuesPerColor(-5));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> game.setNbValuesPerColor(14));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Test
|
|
|
|
|
void test_HashCode() {
|
|
|
|
|
// TODO Implement this method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_Id() {
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(new BigDecimal(i + 1), FIXTURE[i].getId());
|
|
|
|
|
void test_constructor_throwIllegalArgumentExceptionOnInvalidColors(){
|
|
|
|
|
int[] INCORRECT_VALUES = {Integer.MIN_VALUE, -9, -2, 0, 5, 8, Integer.MAX_VALUE};
|
|
|
|
|
for (int incorrect_value : INCORRECT_VALUES) {
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(Game.Difficulty.EASY,4*incorrect_value,incorrect_value, 13));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_Created_At() {
|
|
|
|
|
Date[] dates = new Date[]{new Date(2023,12,25),
|
|
|
|
|
new Date(2024,3,26),
|
|
|
|
|
new Date(2023,9,18)};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(dates[i], FIXTURE[i].getCreatedAt());
|
|
|
|
|
void test_constructor_throwIllegalArgumentExceptionOnInvalidNbRounds(){
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(Game.Difficulty.EASY,0,4, 8));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(Game.Difficulty.EASY,33,4, 8));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(Game.Difficulty.EASY,-5,4, 8));
|
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Game(Game.Difficulty.EASY,13,2, 6));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void test_getId() {
|
|
|
|
|
final HashMap<Game, BigDecimal> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2023-1900,12,25), Game.Difficulty.EASY, 17, 3,6, null), new BigDecimal(1));
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,12,25), Game.Difficulty.EASY, 17, 3,6, null), new BigDecimal(2));
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2023-1900,12,25), Game.Difficulty.EASY, 17, 3,6, null), new BigDecimal(3));
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_Difficulty() {
|
|
|
|
|
Game.Difficulty[] difficulties = new Game.Difficulty[]{
|
|
|
|
|
Game.Difficulty.EASY,
|
|
|
|
|
Game.Difficulty.HARD,
|
|
|
|
|
Game.Difficulty.EASY };
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(difficulties[i], FIXTURE[i].getDifficulty());
|
|
|
|
|
void test_getCreatedAt() {
|
|
|
|
|
final HashMap<Game, Date> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
new Date(2024-1900,5,6));
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
new Date(2023-1900,7,9));
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
new Date(2022-1900,11,12));
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getCreatedAt());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void set_difficulty() {
|
|
|
|
|
Game.Difficulty[] difficulties = new Game.Difficulty[]{
|
|
|
|
|
Game.Difficulty.EASY,
|
|
|
|
|
Game.Difficulty.HARD,
|
|
|
|
|
Game.Difficulty.EASY };
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
FIXTURE[i].setDifficulty(Game.Difficulty.HARD);
|
|
|
|
|
assertEquals(Game.Difficulty.HARD, FIXTURE[i].getDifficulty());
|
|
|
|
|
FIXTURE[i].setDifficulty(difficulties[i]);
|
|
|
|
|
assertEquals(difficulties[i], FIXTURE[i].getDifficulty());
|
|
|
|
|
void test_getDifficulty() {
|
|
|
|
|
final HashMap<Game, Game.Difficulty> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
Game.Difficulty.EASY);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 17, 3,6, null),
|
|
|
|
|
Game.Difficulty.HARD);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
Game.Difficulty.EASY);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getDifficulty());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_nb_Rounds() {
|
|
|
|
|
int[] nbRounds = new int[]{17, 52, 5};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(nbRounds[i], FIXTURE[i].getNbRounds());
|
|
|
|
|
void test_setDifficulty() {
|
|
|
|
|
final HashMap<Game, Game.Difficulty> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
Game.Difficulty.HARD);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 17, 3,6, null),
|
|
|
|
|
Game.Difficulty.HARD);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
Game.Difficulty.HARD);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
Game.Difficulty expected = TESTS.get(game);
|
|
|
|
|
game.setDifficulty(Game.Difficulty.HARD);
|
|
|
|
|
assertEquals(expected, game.getDifficulty());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void set_nb_Rounds() {
|
|
|
|
|
int[] nbRounds = new int[]{17, 52, 5};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
FIXTURE[i].setNbRounds(10);
|
|
|
|
|
assertEquals(10, FIXTURE[i].getNbRounds());
|
|
|
|
|
FIXTURE[i].setNbRounds(nbRounds[i]);
|
|
|
|
|
assertEquals(nbRounds[i], FIXTURE[i].getNbRounds());
|
|
|
|
|
void test_getNbRounds() {
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
17);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
28);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
16);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getNbRounds());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_nb_Colors() {
|
|
|
|
|
int[] nbColors = new int[]{3, 4, 2};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(nbColors[i], FIXTURE[i].getNbColors());
|
|
|
|
|
void test_setNbRounds() {
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
5);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
5);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
5);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
int expected = TESTS.get(game);
|
|
|
|
|
game.setNbRounds(5);
|
|
|
|
|
assertEquals(expected, game.getNbRounds());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void set_nb_Colors() {
|
|
|
|
|
int[] nbColors = new int[]{3, 4, 2};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
FIXTURE[i].setNbColors(1);
|
|
|
|
|
assertEquals(1, FIXTURE[i].getNbColors());
|
|
|
|
|
FIXTURE[i].setNbColors(nbColors[i]);
|
|
|
|
|
assertEquals(nbColors[i], FIXTURE[i].getNbColors());
|
|
|
|
|
void test_getNbColors() {
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
3);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
4);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
2);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getNbColors());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void getnbValuesPerColor() {
|
|
|
|
|
int[] nbValuesPerColor = new int[]{6, 13, 10};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(nbValuesPerColor[i], FIXTURE[i].getNbValuesPerColor());
|
|
|
|
|
void test_setNbColors() {
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
4);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
4);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
4);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
int expected = TESTS.get(game);
|
|
|
|
|
game.setNbColors(4);
|
|
|
|
|
assertEquals(expected, game.getNbColors());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void setNbValuesPerColor() {
|
|
|
|
|
int[] nbValuesPerColor = new int[]{6, 13, 10};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
FIXTURE[i].setNbValuesPerColor(8);
|
|
|
|
|
assertEquals(8,FIXTURE[i].getNbValuesPerColor());
|
|
|
|
|
FIXTURE[i].setNbValuesPerColor(nbValuesPerColor[i]);
|
|
|
|
|
assertEquals(nbValuesPerColor[i], FIXTURE[i].getNbValuesPerColor());
|
|
|
|
|
void test_getNbValuesPerColor() {
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
6);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
13);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
9);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getNbValuesPerColor());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_Players_return_rigth_number_of_players() {
|
|
|
|
|
Player[] players = new Player[]{
|
|
|
|
|
new Player(FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE)),
|
|
|
|
|
new Player(FIXTURE[1], new User("username2", "email2", "password2", new Date(1996, 4, 7), User.Gender.MALE)),
|
|
|
|
|
new Player(FIXTURE[2], new User("username3", "email3", "password3", new Date(1996, 4, 7), User.Gender.MALE)),
|
|
|
|
|
new Player(FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE)),
|
|
|
|
|
};
|
|
|
|
|
assertEquals(2, FIXTURE[0].getPlayers().size());
|
|
|
|
|
assertEquals(1, FIXTURE[1].getPlayers().size());
|
|
|
|
|
assertEquals(1, FIXTURE[2].getPlayers().size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void get_players_return_the_right_players() {
|
|
|
|
|
Player[] players = new Player[]{
|
|
|
|
|
new Player(new BigDecimal(1), FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE),5, true, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(2), FIXTURE[1], new User("username2", "email2", "password2", new Date(1996, 4, 7), User.Gender.MALE),34, false, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(3), FIXTURE[2], new User("username3", "email3", "password3", new Date(1996, 4, 7), User.Gender.MALE),22, false, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(4), FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE),68, true, 7,7,7),
|
|
|
|
|
};
|
|
|
|
|
assertEquals(players[0], FIXTURE[0].getPlayers().get(0));
|
|
|
|
|
assertEquals(players[3], FIXTURE[0].getPlayers().get(1));
|
|
|
|
|
assertEquals(players[1], FIXTURE[1].getPlayers().get(0));
|
|
|
|
|
assertEquals(players[2], FIXTURE[2].getPlayers().get(0));
|
|
|
|
|
}
|
|
|
|
|
@Test
|
|
|
|
|
void setPlayers() {
|
|
|
|
|
Player[] players = new Player[]{
|
|
|
|
|
new Player(new BigDecimal(5), FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE),5, true, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(6), FIXTURE[1], new User("username2", "email2", "password2", new Date(1996, 4, 7), User.Gender.MALE),34, false, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(7), FIXTURE[2], new User("username3", "email3", "password3", new Date(1996, 4, 7), User.Gender.MALE),22, false, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(8), FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE),68, true, 7,7,7),
|
|
|
|
|
};
|
|
|
|
|
ArrayList<Player> newPlayers1 = new ArrayList<Player>();
|
|
|
|
|
newPlayers1.add(players[0]);
|
|
|
|
|
newPlayers1.add(players[3]);
|
|
|
|
|
ArrayList<Player> newPlayers2 = new ArrayList<Player>();
|
|
|
|
|
newPlayers2.add(players[1]);
|
|
|
|
|
ArrayList<Player> newPlayers3 = new ArrayList<Player>();
|
|
|
|
|
newPlayers3.add(players[2]);
|
|
|
|
|
|
|
|
|
|
FIXTURE[0].setPlayers(newPlayers1);
|
|
|
|
|
FIXTURE[1].setPlayers(newPlayers2);
|
|
|
|
|
FIXTURE[2].setPlayers(newPlayers3);
|
|
|
|
|
assertEquals(players[0], FIXTURE[0].getPlayers().get(0));
|
|
|
|
|
assertEquals(players[3], FIXTURE[0].getPlayers().get(1));
|
|
|
|
|
assertEquals(players[1], FIXTURE[1].getPlayers().get(0));
|
|
|
|
|
assertEquals(players[2], FIXTURE[2].getPlayers().get(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void getNbPlayers() {
|
|
|
|
|
int[] nbPlayers = new int[]{2, 1, 1};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(nbPlayers[i], FIXTURE[i].getNbPlayers());
|
|
|
|
|
void test_setNbValuesPerColor() {
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
12);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
12);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
12);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
int expected = TESTS.get(game);
|
|
|
|
|
game.setNbValuesPerColor(12);
|
|
|
|
|
assertEquals(expected, game.getNbValuesPerColor());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void addPlayer() {
|
|
|
|
|
Player player1 = new Player(new BigDecimal(5), FIXTURE[0], new User("username5", "email5", "password5", new Date(1996, 4, 7), User.Gender.MALE),41, true, 7,7,7);
|
|
|
|
|
Player player2 = new Player(new BigDecimal(6), FIXTURE[0], new User("username6", "email6", "password6", new Date(1996, 4, 7), User.Gender.MALE),41, true, 7,7,7);
|
|
|
|
|
FIXTURE[0].addPlayer(player1);
|
|
|
|
|
assertEquals(FIXTURE[0].getPlayers().size(), 3);
|
|
|
|
|
FIXTURE[0].addPlayer(player2);
|
|
|
|
|
assertEquals(FIXTURE[0].getPlayers().size(), 4);
|
|
|
|
|
Player[] expected = new Player[]{
|
|
|
|
|
new Player(new BigDecimal(1), FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE),5, true, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(4), FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE),68, true, 7,7,7),
|
|
|
|
|
player1,
|
|
|
|
|
player2
|
|
|
|
|
};
|
|
|
|
|
assertEquals(expected[0], FIXTURE[0].getPlayers().get(0));
|
|
|
|
|
assertEquals(expected[1], FIXTURE[0].getPlayers().get(1));
|
|
|
|
|
assertEquals(expected[2], FIXTURE[0].getPlayers().get(2));
|
|
|
|
|
assertEquals(expected[3], FIXTURE[0].getPlayers().get(3));
|
|
|
|
|
void test_getPlayers() {
|
|
|
|
|
ArrayList<Player> players1 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players2 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players3 = new ArrayList<>();
|
|
|
|
|
players1.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5, 5, 5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(2), new Game(), new User(), 10, true, 5, 5, 5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(3), new Game(), new User(), 10, true, 5, 5, 5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(4), new Game(), new User(), 10, true, 5, 5, 5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(5), new Game(), new User(), 10, true, 5, 5, 5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(6), new Game(), new User(), 10, true, 5, 5, 5));
|
|
|
|
|
final HashMap<Game, ArrayList<Player>> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024 - 1900, 5, 6), Game.Difficulty.EASY, 17, 3, 6, players1),
|
|
|
|
|
players1);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023 - 1900, 7, 9), Game.Difficulty.HARD, 28, 4, 13, players2),
|
|
|
|
|
players2);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022 - 1900, 11, 12), Game.Difficulty.EASY, 16, 2, 9, players3),
|
|
|
|
|
players3);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getPlayers());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void test_setPlayers() {
|
|
|
|
|
ArrayList<Player> players = new ArrayList<>();
|
|
|
|
|
players.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players.add(new Player(new BigDecimal(2), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players.add(new Player(new BigDecimal(3), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players.add(new Player(new BigDecimal(4), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players.add(new Player(new BigDecimal(5), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players.add(new Player(new BigDecimal(6), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
final HashMap<Game, ArrayList<Player>> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
players);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
players);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
players);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
ArrayList<Player> expected = TESTS.get(game);
|
|
|
|
|
game.setPlayers(players);
|
|
|
|
|
assertEquals(expected, game.getPlayers());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void test_getNbPlayers() {
|
|
|
|
|
ArrayList<Player> players1 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players2 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players3 = new ArrayList<>();
|
|
|
|
|
players1.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(2), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(3), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(4), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(5), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(6), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
final HashMap<Game, Integer> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, players1),
|
|
|
|
|
1);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, players2),
|
|
|
|
|
2);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, players3),
|
|
|
|
|
3);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getPlayers().size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void test_addPlayer() {
|
|
|
|
|
//Initial arrays
|
|
|
|
|
ArrayList<Player> players1 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players2 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players3 = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
players1.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(2), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(3), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
|
|
|
|
|
//New Player
|
|
|
|
|
Player player = new Player(new BigDecimal(4), new Game(), new User(), 10, true, 5,5,5);
|
|
|
|
|
|
|
|
|
|
//Expected arrays
|
|
|
|
|
ArrayList<Player> players1Expected = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players2Expected = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players3Expected = new ArrayList<>();
|
|
|
|
|
players1Expected.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players1Expected.add(player);
|
|
|
|
|
players2Expected.add(new Player(new BigDecimal(2), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players2Expected.add(player);
|
|
|
|
|
players3Expected.add(new Player(new BigDecimal(3), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players3Expected.add(player);
|
|
|
|
|
final HashMap<Game, ArrayList<Player>> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, players1),
|
|
|
|
|
players1Expected);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, players2),
|
|
|
|
|
players2Expected);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, players3),
|
|
|
|
|
players3Expected);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
ArrayList<Player> expected = TESTS.get(game);
|
|
|
|
|
game.addPlayer(player);
|
|
|
|
|
assertEquals(expected, game.getPlayers());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void getDeck() {
|
|
|
|
|
|
|
|
|
|
final HashMap<Game, Deck> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
new Deck(3,6));
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
new Deck(4,13));
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
new Deck(2,9));
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.getDeck());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void sortPlayersByScore() {
|
|
|
|
|
ArrayList<Player> players1 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players2 = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players3 = new ArrayList<>();
|
|
|
|
|
players1.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(2), new Game(), new User(), 15, true, 5,5,5));
|
|
|
|
|
players2.add(new Player(new BigDecimal(3), new Game(), new User(), 20, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(4), new Game(), new User(), 6, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(6), new Game(), new User(), 13, true, 5,5,5));
|
|
|
|
|
players3.add(new Player(new BigDecimal(5), new Game(), new User(), 9, true, 5,5,5));
|
|
|
|
|
|
|
|
|
|
Player[] initial = new Player[]{
|
|
|
|
|
new Player(new BigDecimal(1), FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE),5, true, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(4), FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE),68, true, 7,7,7),
|
|
|
|
|
};
|
|
|
|
|
ArrayList<Player> players = FIXTURE[0].getPlayers();
|
|
|
|
|
for (int i = 0; i < players.size(); i++) {
|
|
|
|
|
assertEquals(initial[i], players.get(i));
|
|
|
|
|
}
|
|
|
|
|
Player[] expected = new Player[]{
|
|
|
|
|
new Player(new BigDecimal(4), FIXTURE[0], new User("username4", "email4", "password4", new Date(1996, 4, 7), User.Gender.MALE),68, true, 7,7,7),
|
|
|
|
|
new Player(new BigDecimal(1), FIXTURE[0], new User("username1", "email1", "password1", new Date(1996, 4, 7), User.Gender.MALE),5, true, 7,7,7),
|
|
|
|
|
};
|
|
|
|
|
FIXTURE[0].sortPlayersByScore();
|
|
|
|
|
players = FIXTURE[0].getPlayers();
|
|
|
|
|
for (int i = 0; i < players.size(); i++) {
|
|
|
|
|
System.out.println(i);
|
|
|
|
|
assertEquals(expected[i], players.get(i));
|
|
|
|
|
|
|
|
|
|
//Expected arrays
|
|
|
|
|
ArrayList<Player> players1Expected = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players2Expected = new ArrayList<>();
|
|
|
|
|
ArrayList<Player> players3Expected = new ArrayList<>();
|
|
|
|
|
players1Expected.add(new Player(new BigDecimal(1), new Game(), new User(), 10, true, 5,5,5));
|
|
|
|
|
players2Expected.add(new Player(new BigDecimal(3), new Game(), new User(), 20, true, 5,5,5));
|
|
|
|
|
players2Expected.add(new Player(new BigDecimal(2), new Game(), new User(), 15, true, 5,5,5));
|
|
|
|
|
players3Expected.add(new Player(new BigDecimal(6), new Game(), new User(), 13, true, 5,5,5));
|
|
|
|
|
players3Expected.add(new Player(new BigDecimal(5), new Game(), new User(), 9, true, 5,5,5));
|
|
|
|
|
players3Expected.add(new Player(new BigDecimal(4), new Game(), new User(), 6, true, 5,5,5));
|
|
|
|
|
|
|
|
|
|
final HashMap<Game, ArrayList<Player>> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, players1),
|
|
|
|
|
players1Expected);
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, players2),
|
|
|
|
|
players2Expected);
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, players3),
|
|
|
|
|
players3Expected);
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
ArrayList<Player> expected = TESTS.get(game);
|
|
|
|
|
game.sortPlayersByScore();
|
|
|
|
|
assertEquals(expected, game.getPlayers());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void to_string_return_the_right_format() {
|
|
|
|
|
String[] expected = new String[]{
|
|
|
|
|
"Game{id=1, createdAt=2023-12-25, players=[]}",
|
|
|
|
|
"Game{id=2, createdAt=2024-03-26, players=[]}",
|
|
|
|
|
"Game{id=3, createdAt=2023-09-18, players=[]}"
|
|
|
|
|
};
|
|
|
|
|
for (int i = 0; i < FIXTURE.length; i++) {
|
|
|
|
|
assertEquals(FIXTURE[i].toString(), expected[i]);
|
|
|
|
|
}
|
|
|
|
|
void test_toString() {
|
|
|
|
|
final HashMap<Game, String> TESTS = new HashMap<>() {{
|
|
|
|
|
put(new Game(new BigDecimal(1), new Date(2024-1900,5,6), Game.Difficulty.EASY, 17, 3,6, null),
|
|
|
|
|
"Game{id=1, createdAt=Thu Jun 06 00:00:00 CEST 2024, difficulty=EASY, nbRounds=17, nbColors=3, nbValuesPerColor=6}");
|
|
|
|
|
put(new Game(new BigDecimal(2), new Date(2023-1900,7,9), Game.Difficulty.HARD, 28, 4,13, null),
|
|
|
|
|
"Game{id=2, createdAt=Wed Aug 09 00:00:00 CEST 2023, difficulty=HARD, nbRounds=28, nbColors=4, nbValuesPerColor=13}");
|
|
|
|
|
put(new Game(new BigDecimal(3), new Date(2022-1900,11,12), Game.Difficulty.EASY, 16, 2,9, null),
|
|
|
|
|
"Game{id=3, createdAt=Mon Dec 12 00:00:00 CET 2022, difficulty=EASY, nbRounds=16, nbColors=2, nbValuesPerColor=9}");
|
|
|
|
|
}};
|
|
|
|
|
for (Game game : TESTS.keySet()) {
|
|
|
|
|
assertEquals(TESTS.get(game), game.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|