@Test public void testUseWithCleanup() { final Inventory inventory = mock(Inventory.class); final Character character = mock(Character.class); when(character.getInventory()).thenReturn(inventory); food2.use(character); verify(inventory).cleanup(); verify(character).addToHunger(MAX_HUN); }
@Override public void use(Character character) { super.use(character); int minModifier = ((StatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((StatModifyingItemProperties) properties).getMaxModifier(); character.addToHunger((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier); }
Food extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((StatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((StatModifyingItemProperties) properties).getMaxModifier(); character.addToHunger((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier); } }
Food extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((StatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((StatModifyingItemProperties) properties).getMaxModifier(); character.addToHunger((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier); } Food(StatModifyingItemProperties properties, int amount); }
Food extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((StatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((StatModifyingItemProperties) properties).getMaxModifier(); character.addToHunger((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier); } Food(StatModifyingItemProperties properties, int amount); @Override Item clone(); @Override void use(Character character); int getMinHun(); int getMaxHun(); }
Food extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((StatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((StatModifyingItemProperties) properties).getMaxModifier(); character.addToHunger((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier); } Food(StatModifyingItemProperties properties, int amount); @Override Item clone(); @Override void use(Character character); int getMinHun(); int getMaxHun();  }