public void test_aboutToIndex_unitExcluded() throws Exception {
   // build library with defining unit
   Source librarySource = mock(Source.class);
   LibraryElement library = mock(LibraryElement.class);
   CompilationUnitElement libraryUnit = mock(CompilationUnitElement.class);
   when(library.getContext()).thenReturn(contextA);
   when(library.getDefiningCompilationUnit()).thenReturn(libraryUnit);
   when(library.getSource()).thenReturn(librarySource);
   when(libraryUnit.getContext()).thenReturn(contextA);
   when(libraryUnit.getSource()).thenReturn(librarySource);
   when(libraryUnit.getLibrary()).thenReturn(library);
   // build 2 library units
   CompilationUnitElement unitA = mock(CompilationUnitElement.class);
   CompilationUnitElement unitB = mock(CompilationUnitElement.class);
   when(unitA.getContext()).thenReturn(contextA);
   when(unitB.getContext()).thenReturn(contextA);
   when(unitA.getSource()).thenReturn(sourceA);
   when(unitB.getSource()).thenReturn(sourceB);
   when(unitA.getLibrary()).thenReturn(library);
   when(unitB.getLibrary()).thenReturn(library);
   // prepare locations
   Location locationA = mockLocation(unitA);
   Location locationB = mockLocation(unitB);
   // initially A and B in library
   when(library.getParts()).thenReturn(new CompilationUnitElement[] {unitA, unitB});
   store.aboutToIndex(contextA, libraryUnit);
   store.aboutToIndex(contextA, unitA);
   store.aboutToIndex(contextA, unitB);
   store.recordRelationship(elementA, relationship, locationA);
   store.recordRelationship(elementA, relationship, locationB);
   {
     Location[] locations = store.getRelationships(elementA, relationship);
     assertLocations(locations, locationA, locationB);
   }
   // exclude A from library
   when(library.getParts()).thenReturn(new CompilationUnitElement[] {unitA});
   boolean mayIndex = store.aboutToIndex(contextA, libraryUnit);
   assertTrue(mayIndex);
   {
     Location[] locations = store.getRelationships(elementA, relationship);
     assertLocations(locations, locationA);
   }
   // exclude B from library, empty now
   when(library.getParts()).thenReturn(new CompilationUnitElement[] {});
   store.aboutToIndex(contextA, libraryUnit);
   {
     Location[] locations = store.getRelationships(elementA, relationship);
     assertLocations(locations);
   }
 }