public void test_removeSource_withRelationship_instrumented() throws Exception {
   Location locationB = mockLocation(elementB);
   Location locationC = mockLocation(elementC);
   // record: [B -> A] and [C -> A]
   {
     store.recordRelationship(elementA, relationship, locationB);
     store.recordRelationship(elementA, relationship, locationC);
     assertEquals(2, store.internalGetLocationCount());
     Location[] locations = store.getRelationships(elementA, relationship);
     assertLocations(locations, locationB, locationC);
   }
   // remove B, 1 relation and 1 location left
   InstrumentedAnalysisContextImpl iContextA = mock(InstrumentedAnalysisContextImpl.class);
   when(iContextA.getBasis()).thenReturn(contextA);
   store.removeSource(iContextA, sourceB);
   assertEquals(1, store.internalGetLocationCount());
   assertEquals(1, store.internalGetLocationCount(contextA));
   Location[] locations = store.getRelationships(elementA, relationship);
   assertLocations(locations, locationC);
 }
 public void test_removeContext_instrumented() throws Exception {
   InstrumentedAnalysisContextImpl instrumentedContext =
       mock(InstrumentedAnalysisContextImpl.class);
   when(instrumentedContext.getBasis()).thenReturn(contextA);
   // configure B
   when(elementB.getContext()).thenReturn(contextA);
   Location locationB = mockLocation(elementB);
   // record: [B -> A]
   {
     store.recordRelationship(elementA, relationship, locationB);
     assertEquals(1, store.internalGetLocationCount());
     assertEquals(1, store.internalGetKeyCount());
   }
   // remove _wrapper_ of context A
   InstrumentedAnalysisContextImpl iContextA = mock(InstrumentedAnalysisContextImpl.class);
   when(iContextA.getBasis()).thenReturn(contextA);
   store.removeContext(iContextA);
   assertEquals(0, store.internalGetLocationCount());
   assertEquals(0, store.internalGetKeyCount());
 }