@Test public void testGetDamage() { final int damage = ammunition1.getDamage(); assertThat(damage, greaterThanOrEqualTo(MIN_HIT)); assertThat(damage, lessThanOrEqualTo(MAX_HIT)); assertEquals(MAX_HIT, ammunition2.getDamage()); }
public int getDamage() { int minModifier = ((AmmunitionProperties) properties).getMinHit(); int maxModifier = ((AmmunitionProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; }
Ammunition extends AbstractEquipableItem { public int getDamage() { int minModifier = ((AmmunitionProperties) properties).getMinHit(); int maxModifier = ((AmmunitionProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } }
Ammunition extends AbstractEquipableItem { public int getDamage() { int minModifier = ((AmmunitionProperties) properties).getMinHit(); int maxModifier = ((AmmunitionProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } Ammunition(AmmunitionProperties properties, int amount); }
Ammunition extends AbstractEquipableItem { public int getDamage() { int minModifier = ((AmmunitionProperties) properties).getMinHit(); int maxModifier = ((AmmunitionProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } Ammunition(AmmunitionProperties properties, int amount); @Override Item clone(); @Override void use(Character character); int getMinHit(); int getMaxHit(); int getDamage(); }
Ammunition extends AbstractEquipableItem { public int getDamage() { int minModifier = ((AmmunitionProperties) properties).getMinHit(); int maxModifier = ((AmmunitionProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } Ammunition(AmmunitionProperties properties, int amount); @Override Item clone(); @Override void use(Character character); int getMinHit(); int getMaxHit(); int getDamage();  }