Package web.servlets

Examples of web.servlets.MockParametersMap


*/
public class MockParametersMapTest {

  @Test  //TODO add description here
  public final void testMockParametersMap() {
    final MockParametersMap map = new MockParametersMap();
    assertNotNull(
        "check if the map is not initialized",
        map
        );
    assertNotNull(
        "check if there is a sessionId",
        map.get("sessionId")
        );
    assertNotNull(
        "check if there is a sessionId",
        map.get("uri")
        );
    assertNotNull(
        "check if there is a sessionId",
        map.get("baseUrl")
        );
  }
View Full Code Here


public class GamePlayersTest {

  @Test//TODO add description here
  public final void testProcessRequest() throws Exception{
    final GameEngine engine = GameEngine.instance();
    final MockParametersMap map = new MockParametersMap();
   
    BoardMap boardMap = BoardMapImpl.getNewInstance("pnth");
    boardMap.prepareMap("web/maps/pnth.xml");
    User user = UserImpl.getNewInstance("Hussain", "hussain@game.com");
    Game game = GameImpl.getNewInstance("new game", user,boardMap);
   
    Detective detective = new Detective(user);
    game.addDetective(detective);
   
    game.setPlayerPosition(detective.getEmail(), boardMap.getCoordinates().iterator().next().getLabel());
   
    GamePlayersJsonContainer container = new GamePlayersJsonContainer(game);
   
    assertNull(
        "mr x has not been initialized",
        container.mrx
        );
   
    assertNotNull(
      "check if the container has been initialized correctly",
      container.detectives
      );
   
    assertEquals(
        "testing if the container contains one detective",
        1,
        container.detectives.size()
      );
   
    //System.out.println(container.toJson());
   
    map.put("gameId", game.getIdentifier());
   
    final String json = (String)new GamePlayers().processRequest(map, engine);
    final GamePlayersJsonContainer gpjc = new GamePlayersJsonContainer().fromJson(json);
    assertEquals(gpjc.detectives.size(),1);
  }
View Full Code Here

TOP

Related Classes of web.servlets.MockParametersMap

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.