PendingReferenceRegistry { void addPendingAssertion(NamedResource owner, Assertion assertion, Object object, URI context) { assert owner != null; assert assertion != null; assert object != null; final PendingAssertion pa = new PendingAssertion(owner, assertion, context); if (!pendingAssertions.containsKey(object)) { pendingAssertions.put(object, new HashSet<>()); } pendingAssertions.get(object).add(pa); }    }
@Test public void addPendingAssertionAddsPendingAssertionToObjectsMap() throws Exception { registry.addPendingAssertion(owner, assertion, object, null); final Map<Object, Set<PendingAssertion>> assertions = getPendingAssertions(); assertTrue(assertions.containsKey(object)); final Set<PendingAssertion> pending = assertions.get(object); assertEquals(1, pending.size()); final PendingAssertion pa = pending.iterator().next(); assertEquals(owner, pa.getOwner()); assertEquals(assertion, pa.getAssertion()); assertNull(pa.getContext()); }
@Test public void addPendingAssertionAddsPendingAssertionToObjectsMapWithContext() throws Exception { final URI context = Generators.createIndividualIdentifier(); registry.addPendingAssertion(owner, assertion, object, context); final Map<Object, Set<PendingAssertion>> assertions = getPendingAssertions(); assertTrue(assertions.containsKey(object)); final Set<PendingAssertion> pending = assertions.get(object); assertEquals(1, pending.size()); final PendingAssertion pa = pending.iterator().next(); assertEquals(owner, pa.getOwner()); assertEquals(assertion, pa.getAssertion()); assertEquals(context, pa.getContext()); }