Inventory extends Observable implements Iterable<SimpleResource> { public boolean containsItem(SimpleResource item) { for (SimpleResource resource: inventoryArray){ if (resource.getType().equals(item.getType())){ return true; } } return false; } Inventory(); int addToRucksack(SimpleResource resource); int removeFromRucksack(SimpleResource resource, int quantity); void setEquippedTool(ToolType tool); ToolType getEquippedTool(); SimpleResource getResource(String type); boolean containsTool(ToolType type); boolean containsItem(SimpleResource item); boolean isFull(); int getSize(); ArrayList<SimpleResource> getList(); void handleObservers(); @Override Iterator<SimpleResource> iterator(); @Override String toString();  }
@Test public void containsItemTest() { rucksack = new Inventory(); assertEquals(rucksack.containsItem(new SimpleResource("Banana", hashtable, 5)), false); rucksack.addToRucksack(new SimpleResource("Banana", hashtable, 10)); assertEquals(rucksack.containsItem(new SimpleResource("Banana", hashtable, 5)), true); }