コード例 #1
0
 @Test
 public void testIsValidTarget() {
   World world = new WorldImpl(10, 10, null, null);
   WorldObject performer = createPerformer(2);
   WorldObject target = TestUtils.createWorldObject(0, 0, 1, 1);
   assertEquals(true, Actions.BUILD_ARENA_ACTION.isValidTarget(performer, target, world));
 }
コード例 #2
0
  @Test
  public void testIsActionPossible() {
    World world = new WorldImpl(1, 1, null, null);
    WorldObject performer = createPerformer(2);
    WorldObject target = createPerformer(3);
    performer.getProperty(Constants.INVENTORY).addQuantity(Item.STONE.generate(1f), 10);

    assertEquals(
        true, Actions.BUILD_ARENA_ACTION.isActionPossible(performer, target, Args.EMPTY, world));
  }
コード例 #3
0
  @Test
  public void testExecute() {
    World world = new WorldImpl(20, 20, null, null);
    WorldObject performer = createPerformer(2);
    WorldObject target = createPerformer(3);
    Actions.BUILD_ARENA_ACTION.execute(performer, target, Args.EMPTY, world);

    assertEquals(6, world.getWorldObjects().size());
    assertEquals("Arena vertical", world.getWorldObjects().get(0).getProperty(Constants.NAME));
  }