@Test public void locationOfItemFindsItem() { Item item = getRegularItem(); inventory.executeAddItem(InventorySlot.HEAD, item); ItemLocation loc = inventory.getLocationOf(item); assertNotNull(loc); assertSame(item, loc.get()); assertEquals(InventorySlot.HEAD.ordinal(), loc.getIndex()); assertSame(inventory, loc.getCylinder()); }
@Test public void locationOfUnknownItemIsNull() { Item item = getRegularItem(); ItemLocation loc = inventory.getLocationOf(item); assertNull(loc); }
@Test public void locationOfNonItemThingIsNull() { TestableCreature creature = new TestableCreature(1, "1"); ItemLocation loc = inventory.getLocationOf(creature); assertNull(loc); }