Package org.scotlandyard.impl.engine

Examples of org.scotlandyard.impl.engine.UserImpl


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

    user = new UserImpl(name, email);
    engine.getUsers().put(getSessionId(), user);

    return (new JsonContainerAdapter("done").toJson());

  }
View Full Code Here


    GameEngine.instance().getUsers().clear();
  }

  @Test  //TODO add description of what the test should do
  public final void testAddDetective() throws GameException{
    final User creator = new UserImpl("user1", "user1@game.com");
    Game game;
    try{
      game = GameImpl.getNewInstance("game1", creator, boardMap);
      Assert.assertTrue(false);
    }catch(GameException ex){
      Assert.assertTrue(true);
    }
    Assert.assertEquals(GameEngine.instance().getLobby().getAvailableGames().size(),0);
    GameEngine.instance().loginUser(creator);
    Assert.assertNotNull(GameEngine.instance().getUser(creator.getEmail()));
    Assert.assertEquals(GameEngine.instance().getUser(creator.getEmail()), creator);
    game = GameImpl.getNewInstance("game1", creator, boardMap);
    Assert.assertEquals(GameEngine.instance().getLobby().getAvailableGames().size(),1);
    Assert.assertEquals(game.getDetectives().size(),0);
    Assert.assertEquals(game.getPlayers().size(),0);
    final Player player = Detective.getNewInstance(game, creator);
    Assert.assertEquals(game.getDetectives().size(),1);
    Assert.assertEquals(game.getPlayers().size(),1);
    Assert.assertEquals(game.getPlayer(creator.getEmail()),player);
    Assert.assertEquals(game.getPlayer(player.getEmail()),player);
    Assert.assertEquals(creator.getEmail(),player.getEmail());
    Assert.assertEquals(creator.getName(),player.getName());
    Assert.assertNotNull(creator);
    Assert.assertNotNull(creator.getEmail());
    Assert.assertNull(game.getMrX());
    GameEngine.instance().logoutUser(creator.getEmail());
    try{
      game.removePlayer(creator.getEmail());
      Assert.assertFalse(true);
    }catch(GameException ex){
      Assert.assertTrue(true);
    }
    GameEngine.instance().getLobby().removeGame(game.getIdentifier());
View Full Code Here

  @Test  //TODO add description of what the test should do
  public final void testRemove() throws GameException{
    final GameEngine engine = GameEngine.instance();
    User user1,user2;
    user1 = new UserImpl("user1","user1");
    user2 = new UserImpl("user2","user2");
    Assert.assertEquals(engine.getUsers().size(), 0);
    engine.loginUser(user1);
    engine.loginUser(user2);

View Full Code Here

TOP

Related Classes of org.scotlandyard.impl.engine.UserImpl

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.