}
@Test
public void testSaveGame() {
System.out.println("saveGame");
Database database = new JPADatabase();
database.startTransaction();
GameTypeRoom gameTypeRoom = database.getGameTypes().iterator().next();
database.endTransaction();
User user = new User();
database.startTransaction();
database.saveUser(user);
database.endTransaction();
GameRoom gameRoom = new GameRoom();
gameRoom.setName("Test Game Room");
gameRoom.setMaxPlayers(2);
gameRoom.setOptions("0\n2\n2\nchoosemap sersom.map\nstartgame domination increasing");
gameRoom.setGameTypeRoom(gameTypeRoom);
gameTypeRoom.getGameRooms().add(gameRoom);
gameRoom.getUsers().add(user);
user.getGames().add(gameRoom);
database.startTransaction();
database.saveGame(gameRoom);
database.endTransaction();
User user2 = new User();
database.startTransaction();
database.saveUser(user2);
database.endTransaction();
gameRoom.getUsers().add(user2);
user2.getGames().add(gameRoom);
database.startTransaction();
database.saveGame(gameRoom);
database.endTransaction();
}