@Test public void testHasFreeSlots() { final Item[] item = new Item[inventory.getCapacity()]; for (int i = 0; i< inventory.getCapacity(); i++) { item[i] = MockFactory.mockItem(i + 1, 1); assertTrue(inventory.hasFreeSlots()); inventory.addItem(item[i]); } assertFalse(inventory.hasFreeSlots()); inventory.removeItem(0); assertTrue(inventory.hasFreeSlots()); }
@Override public boolean hasFreeSlots() { for (Item item : inventory) { if (item == null) { return true; } } return false; }
InventoryImpl implements Inventory { @Override public boolean hasFreeSlots() { for (Item item : inventory) { if (item == null) { return true; } } return false; } }
InventoryImpl implements Inventory { @Override public boolean hasFreeSlots() { for (Item item : inventory) { if (item == null) { return true; } } return false; } InventoryImpl();  InventoryImpl(int slots);  InventoryImpl(Item[] inventory); }
InventoryImpl implements Inventory { @Override public boolean hasFreeSlots() { for (Item item : inventory) { if (item == null) { return true; } } return false; } 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 boolean hasFreeSlots() { for (Item item : inventory) { if (item == null) { return true; } } return false; } 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();  }