@Test public void testUseWithCleanup() { final Inventory inventory = mock(Inventory.class); final Character character = mock(Character.class); when(character.getInventory()).thenReturn(inventory); potion2.use(character); verify(inventory).cleanup(); verify(character).addToStrength(MAX_STR, DURATION); }
@Override public void use(Character character) { super.use(character); int minModifier = ((TemporalStatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((TemporalStatModifyingItemProperties) properties).getMaxModifier(); int time = ((TemporalStatModifyingItemProperties) properties).getEffectDuration(); character.addToStrength((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier, time); }
StrengthPotion extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((TemporalStatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((TemporalStatModifyingItemProperties) properties).getMaxModifier(); int time = ((TemporalStatModifyingItemProperties) properties).getEffectDuration(); character.addToStrength((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier, time); } }
StrengthPotion extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((TemporalStatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((TemporalStatModifyingItemProperties) properties).getMaxModifier(); int time = ((TemporalStatModifyingItemProperties) properties).getEffectDuration(); character.addToStrength((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier, time); } StrengthPotion(TemporalStatModifyingItemProperties properties, int amount); }
StrengthPotion extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((TemporalStatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((TemporalStatModifyingItemProperties) properties).getMaxModifier(); int time = ((TemporalStatModifyingItemProperties) properties).getEffectDuration(); character.addToStrength((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier, time); } StrengthPotion(TemporalStatModifyingItemProperties properties, int amount); @Override Item clone(); @Override void use(Character character); int getMinModifier(); int getMaxModifier(); int getEffectDuration(); }
StrengthPotion extends ConsumableItem { @Override public void use(Character character) { super.use(character); int minModifier = ((TemporalStatModifyingItemProperties) properties).getMinModifier(); int maxModifier = ((TemporalStatModifyingItemProperties) properties).getMaxModifier(); int time = ((TemporalStatModifyingItemProperties) properties).getEffectDuration(); character.addToStrength((int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier, time); } StrengthPotion(TemporalStatModifyingItemProperties properties, int amount); @Override Item clone(); @Override void use(Character character); int getMinModifier(); int getMaxModifier(); int getEffectDuration();  }