Package games.stendhal.server.core.engine

Examples of games.stendhal.server.core.engine.StendhalRPZone


  /**
   * Tests for onActionOwnsPetOfDifferentName.
   */
  @Test
  public void testOnActionOwnsPetOfDifferentName() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "noname");
    action.put("args", "newname");
    final Sheep pet = new Sheep();
   
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You don't own a pet called 'noname'"));
    assertThat(pet.getTitle(), is("sheep"));
View Full Code Here


  /**
   * Tests for onActionName.
   */
  @Test
  public void testOnActionName() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "newname");
    final Sheep pet = new Sheep();
   
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'sheep' to 'newname'"));
    assertThat(pet.getTitle(), is("newname"));
View Full Code Here

  /**
   * Tests for onActionNameWithQuotesAndSpace.
   */
  @Test
  public void testOnActionNameWithQuotesAndSpace() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "' newname '");
    final Sheep pet = new Sheep();
   
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'sheep' to 'newname'"));
    assertThat(pet.getTitle(), is("newname"));
View Full Code Here

  /**
   * Tests for onActionNameToExisting.
   */
  @Test
  public void testOnActionNameToExisting() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "sheep");
    final Sheep pet = new Sheep();
   
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You own already a pet named 'sheep'"));
  }
View Full Code Here

  /**
   * Tests for onActionRename.
   */
  @Test
  public void testOnActionRename() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "oldname");
    action.put("args", "newname");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to 'newname'"));
    assertThat(pet.getTitle(), is("newname"));
View Full Code Here

  /**
   * Tests for onActionRenameBack.
   */
  @Test
  public void testOnActionRenameBack() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "oldname");
    action.put("args", "sheep");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to 'sheep'"));
    assertThat(pet.getTitle(), is("sheep"));
View Full Code Here

  /**
   * Tests for onActionRenameWithGenericName.
   */
  @Test
  public void testOnActionRenameWithGenericName() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "newname");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to 'newname'"));
    assertThat(pet.getTitle(), is("newname"));
View Full Code Here

  /**
   * Tests for onActionRenameBackWithGenericName.
   */
  @Test
  public void testOnActionRenameBackWithGenericName() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "sheep");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to 'sheep'"));
    assertThat(pet.getTitle(), is("sheep"));
View Full Code Here

  /**
   * Tests for onActionLongestName.
   */
  @Test
  public void testOnActionLongestName() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "oldname");
    action.put("args", "01234567890123456789");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to '01234567890123456789'"));
    assertThat(pet.getTitle(), is("01234567890123456789"));
View Full Code Here

  /**
   * Tests for onActiontooLongName.
   */
  @Test
  public void testOnActiontooLongName() {
    final StendhalRPZone zone = new StendhalRPZone("zone");
    MockStendlRPWorld.get().addRPZone(zone);
   
    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "oldname");
    action.put("args", "012345678901234567890");
   
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("The new name of your pet must not be longer than 20 characters."));
    assertThat(pet.getTitle(), is("oldname"));
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.engine.StendhalRPZone

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.