Package org.scotlandyard.engine.json

Examples of org.scotlandyard.engine.json.UsersJsonContainer


  @Override
   public Object getOutput(
         final HttpServletRequest request,
        final GameEngine engine) throws GameException {

    return new UsersJsonContainer(engine.getUsers().values()).toJson();
  }
View Full Code Here


    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()
        );
View Full Code Here

      );
    }

  @Test  //TODO add description of what the test should do
  public final void testGetObjectName(){
    final UsersJsonContainer ujc = new UsersJsonContainer();
    assertNull(
        "check if the container users has not been initialized",
        ujc.users
        );
    assertEquals(
View Full Code Here

TOP

Related Classes of org.scotlandyard.engine.json.UsersJsonContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.