@Test public void testClone() { final RangedWeapon clone = (RangedWeapon) weapon1.clone(); assertEquals(weapon1.amount, clone.amount); assertEquals(weapon1.properties, clone.properties); assertNotSame(weapon1, clone); final RangedWeapon clone2 = (RangedWeapon) weapon2.clone(); assertEquals(weapon2.amount, clone2.amount); assertEquals(weapon2.properties, clone2.properties); assertNotSame(weapon2, clone2); }
@Override public Item clone() { return new RangedWeapon((RangedWeaponProperties) properties, amount); }
RangedWeapon extends Weapon { @Override public Item clone() { return new RangedWeapon((RangedWeaponProperties) properties, amount); } }
RangedWeapon extends Weapon { @Override public Item clone() { return new RangedWeapon((RangedWeaponProperties) properties, amount); } RangedWeapon(RangedWeaponProperties properties, int amount); }
RangedWeapon extends Weapon { @Override public Item clone() { return new RangedWeapon((RangedWeaponProperties) properties, amount); } RangedWeapon(RangedWeaponProperties properties, int amount); @Override Item clone(); @Override void use(Character character); @Override int getDamage(); boolean getNeedsAmmunition(); }
RangedWeapon extends Weapon { @Override public Item clone() { return new RangedWeapon((RangedWeaponProperties) properties, amount); } RangedWeapon(RangedWeaponProperties properties, int amount); @Override Item clone(); @Override void use(Character character); @Override int getDamage(); boolean getNeedsAmmunition();  }