assertEquals(
"check if the number of users in the engine is zero",
0,
GameEngine.instance().getUsers().size()
);
final UsersJsonContainer ujc;
UserImpl.getNewInstance("user1", "email1");
UserImpl.getNewInstance("user2", "email2");
ujc = new UsersJsonContainer(GameEngine.instance().getUsers().values());
assertEquals(
"check if the number of users in the engine is two",
2,
GameEngine.instance().getUsers().size()
);
assertEquals(
"check if the number of users in the container is two",
2,
ujc.users.size()
);
final String json = ujc.toJson();
//System.out.println(json);
assertTrue(
"check if the number of users json string has email and name",
json.contains("\"email1\"") &&
json.contains("\"email2\"") &&
json.contains("\"user1\"") &&
json.contains("\"user2\"")
);
final UsersJsonContainer ujc2 = new UsersJsonContainer().fromJson(json);
assertEquals(
"check if the number of users in the converted container is two",
2,
ujc2.users.size()
);