@Test public void testAddAmount() { final AbstractItem item = (AbstractItem) object; final int ammount = item.getAmount(); if (ammount < AbstractItem.MAX_STACKED_ITEMS) { item.addAmount(1); assertEquals(ammount + 1, item.getAmount()); item.addAmount(-1); assertEquals(ammount, item.getAmount()); } else { item.addAmount(-1); assertEquals(ammount - 1, item.getAmount()); item.addAmount(1); assertEquals(ammount, item.getAmount()); } item.addAmount(AbstractItem.MAX_STACKED_ITEMS + 1); assertEquals(AbstractItem.MAX_STACKED_ITEMS, item.getAmount()); }
@Override public int addAmount(final int amount) { if (this.amount + amount <= MAX_STACKED_ITEMS) { this.amount += amount; } else { this.amount = MAX_STACKED_ITEMS; } return this.amount; }
AbstractItem extends AbstractWorldObject implements Item { @Override public int addAmount(final int amount) { if (this.amount + amount <= MAX_STACKED_ITEMS) { this.amount += amount; } else { this.amount = MAX_STACKED_ITEMS; } return this.amount; } }
AbstractItem extends AbstractWorldObject implements Item { @Override public int addAmount(final int amount) { if (this.amount + amount <= MAX_STACKED_ITEMS) { this.amount += amount; } else { this.amount = MAX_STACKED_ITEMS; } return this.amount; } AbstractItem(final ItemProperties properties, final int amount); }
AbstractItem extends AbstractWorldObject implements Item { @Override public int addAmount(final int amount) { if (this.amount + amount <= MAX_STACKED_ITEMS) { this.amount += amount; } else { this.amount = MAX_STACKED_ITEMS; } return this.amount; } AbstractItem(final ItemProperties properties, final int amount); @Override int addAmount(final int amount); @Override boolean canBeUsedBy(final Race race, final Gender gender,
			final UserArchetype archetype, final Reputation reputation); @Override int getAmount(); @Override int getValue(); @Override boolean isNewbie(); @Override boolean canBeStolen(); @Override abstract Item clone(); boolean isFalls(); boolean isNoLog(); boolean isRespawnable(); }
AbstractItem extends AbstractWorldObject implements Item { @Override public int addAmount(final int amount) { if (this.amount + amount <= MAX_STACKED_ITEMS) { this.amount += amount; } else { this.amount = MAX_STACKED_ITEMS; } return this.amount; } AbstractItem(final ItemProperties properties, final int amount); @Override int addAmount(final int amount); @Override boolean canBeUsedBy(final Race race, final Gender gender,
			final UserArchetype archetype, final Reputation reputation); @Override int getAmount(); @Override int getValue(); @Override boolean isNewbie(); @Override boolean canBeStolen(); @Override abstract Item clone(); boolean isFalls(); boolean isNoLog(); boolean isRespawnable();  }