@Test public void testGetItem() { final Item item = mock(Item.class); inventory.addItem(item); int slot = inventory.hasItem(item); assertNotNull(inventory.getItem(slot)); inventory.getItem(-1); inventory.getItem(inventory.getCapacity()); }
@Override public Item getItem(int slot) { if (slot < 0 || slot >= inventory.length) { return null; } return inventory[slot]; }
InventoryImpl implements Inventory { @Override public Item getItem(int slot) { if (slot < 0 || slot >= inventory.length) { return null; } return inventory[slot]; } }
InventoryImpl implements Inventory { @Override public Item getItem(int slot) { if (slot < 0 || slot >= inventory.length) { return null; } return inventory[slot]; } InventoryImpl();  InventoryImpl(int slots);  InventoryImpl(Item[] inventory); }
InventoryImpl implements Inventory { @Override public Item getItem(int slot) { if (slot < 0 || slot >= inventory.length) { return null; } return inventory[slot]; } InventoryImpl();  InventoryImpl(int slots);  InventoryImpl(Item[] inventory); @Override int addItem(final Item item); @Override Item getItem(int slot); @Override boolean hasFreeSlots(); @Override int hasItem(Item item); @Override Item removeItem(int slot); @Override Item removeItem(Item item); @Override Item removeItem(int slot, int amount); @Override int getCapacity(); @Override int getItemAmount(Item item); @Override void cleanup(); @Override void setCapacity(int capacity); @Override Iterator<Item> iterator(); }
InventoryImpl implements Inventory { @Override public Item getItem(int slot) { if (slot < 0 || slot >= inventory.length) { return null; } return inventory[slot]; } InventoryImpl();  InventoryImpl(int slots);  InventoryImpl(Item[] inventory); @Override int addItem(final Item item); @Override Item getItem(int slot); @Override boolean hasFreeSlots(); @Override int hasItem(Item item); @Override Item removeItem(int slot); @Override Item removeItem(Item item); @Override Item removeItem(int slot, int amount); @Override int getCapacity(); @Override int getItemAmount(Item item); @Override void cleanup(); @Override void setCapacity(int capacity); @Override Iterator<Item> iterator();  }