*/
public class ResetEngineTest {
@Test // TODO add test description
public final void testGetOutput() throws Exception{
final GameEngine engine=GameEngine.instance();
assertEquals(
"testing the number of maps before adding anything",
0,
engine.getBoardMaps().size()
);
assertEquals(
"testing the number of games before adding anything",
0,
engine.getLobby().getAvailableGames().size()
);
assertEquals(
"testing the number of users before adding anything",
0,
engine.getUsers().size()
);
GameImpl.getNewInstance("game1", null, null);
GameImpl.getNewInstance("game2", null, null);
UserImpl.getNewInstance("user", "email");
BoardMapImpl.getNewInstance("map");
assertEquals(
"testing the number of maps after adding new values",
1,
engine.getBoardMaps().size()
);
assertEquals(
"testing the number of games after adding new values",
2,
engine.getLobby().getAvailableGames().size()
);
assertEquals(
"testing the number of users after adding new values",
1,
engine.getUsers().size()
);
String json = (String)new ResetGameEngine().processRequest(null, engine);
assertEquals(
"testing the output json object is not an exception",
"The engine has been reset",
JsonFactory.fromJson(json).message
);
assertEquals(
"testing the number of maps after reseting the engine",
0,
engine.getBoardMaps().size()
);
assertEquals(
"testing the number of games after reseting the engine",
0,
engine.getLobby().getAvailableGames().size()
);
assertEquals(
"testing the number of users after reseting the engine",
0,
engine.getUsers().size()
);
}