PObjectCache { public PObject add(final PObject pObject) { expungeStaleEntries(); final PObjectWeakReference weakReference = new PObjectWeakReference(pObject, queue); referenceByObjectID.put(weakReference.getObjectID(), weakReference); if (log.isDebugEnabled()) log.debug("Registering object: {}", pObject); return pObject; }  PObject add(final PObject pObject); PObject get(final int objectID);  }
@Test public void testAdd() { final PObject uiObject1 = Element.newButton(); final int uiObjectId1 = uiObject1.getID(); cache.add(uiObject1); assertEquals(uiObject1, cache.get(uiObjectId1)); }