@Test public void testIsValidTarget() { World world = new WorldImpl(1, 1, null, null); WorldObject performer = createPerformer(2); WorldObject target = createVotingBox(world); target.setProperty(Constants.ORGANIZATION_ID, 7); assertEquals(true, Actions.VOTE_FOR_LEADER_ACTION.isValidTarget(performer, target, world)); assertEquals(false, Actions.VOTE_FOR_LEADER_ACTION.isValidTarget(performer, performer, world)); }
@Test public void testDistance() { World world = new WorldImpl(1, 1, null, null); WorldObject performer = createPerformer(2); WorldObject target = createVotingBox(world); assertEquals(0, Actions.VOTE_FOR_LEADER_ACTION.distance(performer, target, Args.EMPTY, world)); }
@Test public void testExecute() { World world = new WorldImpl(1, 1, null, null); WorldObject performer = createPerformer(2); WorldObject target = createVotingBox(world); Actions.VOTE_FOR_LEADER_ACTION.execute(performer, target, new int[] {7}, world); assertEquals(1, target.getProperty(Constants.VOTES).getValue(7)); }
@Test public void testIsActionPossible() { World world = new WorldImpl(1, 1, null, null); WorldObject performer = createPerformer(2); WorldObject target = createVotingBox(world); WorldObject organization = GroupPropertyUtils.createProfessionOrganization( performer.getProperty(Constants.ID), "", Professions.FARMER_PROFESSION, world); target.setProperty(Constants.ORGANIZATION_ID, organization.getProperty(Constants.ID)); target.setProperty(Constants.TURN_COUNTER, 450); assertEquals( true, Actions.VOTE_FOR_LEADER_ACTION.isActionPossible(performer, target, Args.EMPTY, world)); }