Inventory extends Observable implements Iterable<SimpleResource> { public SimpleResource getResource(String type) { for (SimpleResource resource: inventoryArray){ if (resource.getType().toLowerCase().equals(type.toLowerCase())){ return resource; } } return null; } 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 getResourceTest() { rucksack = new Inventory(); assertEquals(rucksack.getResource("Banana"), null); rucksack.addToRucksack(new SimpleResource("Banana", hashtable, 10)); assertEquals(rucksack.getResource("Banana"), new SimpleResource("Banana", hashtable, 10)); assertEquals(rucksack.getResource("banana"), new SimpleResource("Banana", hashtable, 10)); assertEquals(rucksack.getResource("BANANA"), new SimpleResource("Banana", hashtable, 10)); assertEquals(rucksack.getResource("apple"), null); }