Examples of WhoAction


Examples of games.stendhal.server.actions.query.WhoAction

  /**
   * Tests for onAction.
   */
  @Test
  public void testOnAction() {
    final WhoAction pq = new WhoAction();
    final RPAction action = new RPAction();
    action.put(Actions.TYPE, "who");
    final Player player = PlayerTestHelper.createPlayer("player");
    pq.onAction(player, action);
    assertThat(player.events().get(0).get("text"), equalTo("0 Players online: "));
    player.clearEvents();
    MockStendhalRPRuleProcessor.get().addPlayer(player);
    pq.onAction(player, action);
    assertThat(player.events().get(0).get("text"), equalTo("1 Players online: player(0) "));
    player.clearEvents();

    player.setAdminLevel(AdministrationAction.getLevelForCommand("ghostmode") - 1);
    player.setGhost(true);
    pq.onAction(player, action);
    assertThat(player.events().get(0).get("text"), equalTo("0 Players online: "));
    player.clearEvents();

    player.setAdminLevel(AdministrationAction.getLevelForCommand("ghostmode"));
    player.setGhost(true);
    pq.onAction(player, action);
    assertThat(player.events().get(0).get("text"), equalTo("1 Players online: player(!0) "));
    player.clearEvents();
   
    player.setAdminLevel(AdministrationAction.getLevelForCommand("ghostmode") + 1);
    player.setGhost(true);
    pq.onAction(player, action);
    assertThat(player.events().get(0).get("text"), equalTo("1 Players online: player(!0) "));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.