/** Tests for executeNonameSeed. */ @Test public void testExecuteNonameSeed() { final Seed seed = (Seed) SingletonRepository.getEntityManager().getItem("seed"); final Player player = PlayerTestHelper.createPlayer("bob"); assertNotNull(player); final StendhalRPZone zone = new StendhalRPZone("zone"); SingletonRepository.getRPWorld().addRPZone(zone); zone.add(player); assertNotNull(seed); zone.add(seed); seed.setPosition(1, 0); assertTrue(seed.onUsed(player)); final Entity entity = player.getZone().getEntityAt(1, 0); assertNotNull(entity); if (entity instanceof FlowerGrower) { final FlowerGrower flg = (FlowerGrower) entity; flg.setToFullGrowth(); flg.onUsed(player); assertNull(player.getZone().getEntityAt(1, 0)); assertTrue(player.isEquipped("lilia")); } else { fail("seed produced non flowergrower"); } }
/** Tests for executeSeedInBag. */ @Test public void testExecuteSeedInBag() { final Seed seed = (Seed) SingletonRepository.getEntityManager().getItem("seed"); final Player player = PlayerTestHelper.createPlayer("bob"); assertNotNull(player); final StendhalRPZone zone = new StendhalRPZone("zone"); SingletonRepository.getRPWorld().addRPZone(zone); zone.add(player); assertNotNull(seed); player.equip("bag", seed); assertFalse(seed.onUsed(player)); }
/** Tests for execute. */ @Test public void testExecute() { final Seed seed = (Seed) SingletonRepository.getEntityManager().getItem("seed"); final Player player = PlayerTestHelper.createPlayer("bob"); assertNotNull(player); final StendhalRPZone zone = new StendhalRPZone("zone"); SingletonRepository.getRPWorld().addRPZone(zone); zone.add(player); assertNotNull(seed); zone.add(seed); seed.setPosition(1, 0); assertTrue(seed.onUsed(player)); assertNotNull(player.getZone().getEntityAt(1, 0)); assertTrue(player.getZone().getEntityAt(1, 0) instanceof FlowerGrower); }