### Question:
CompositePersistence implements Persistence<O, A> { @Override public boolean supportsIndex(Index<O> index) { Persistence<O, A> persistence = getPersistenceForIndexOrNullWithCaching(index); return persistence != null; } CompositePersistence(Persistence<O, A> primaryPersistence, Persistence<O, A> secondaryPersistence, List<? extends Persistence<O, A>> additionalPersistences); @Override SimpleAttribute<O, A> getPrimaryKeyAttribute(); @Override boolean supportsIndex(Index<O> index); Persistence<O, A> getPersistenceForIndex(Index<O> index); @Override ObjectStore<O> createObjectStore(); Persistence<O, A> getPrimaryPersistence(); Persistence<O, A> getSecondaryPersistence(); List<? extends Persistence<O, A>> getAdditionalPersistences(); @Override void openRequestScopeResources(QueryOptions queryOptions); @Override void closeRequestScopeResources(QueryOptions queryOptions); static CompositePersistence<O, A> of(Persistence<O, A> primaryPersistence, Persistence<O, A> secondaryPersistence, List<? extends Persistence<O, A>> additionalPersistences); static CompositePersistence<O, A> of(Persistence<O, A> primaryPersistence, Persistence<O, A> secondaryPersistence);  }### Answer:
@Test public void testSupportsIndex() throws Exception { Index<Car> index1 = mockIndex("index1"); Index<Car> index2 = mockIndex("index2"); Persistence<Car, Integer> persistence1 = mockPersistence("persistence1"); Persistence<Car, Integer> persistence2 = mockPersistence("persistence2"); when(persistence1.getPrimaryKeyAttribute()).thenReturn(Car.CAR_ID); when(persistence2.getPrimaryKeyAttribute()).thenReturn(Car.CAR_ID); when(persistence1.supportsIndex(index1)).thenReturn(true); CompositePersistence<Car, Integer> compositePersistence = new CompositePersistence<Car, Integer>(persistence1, persistence2, noAdditionalPersistences()); assertTrue(compositePersistence.supportsIndex(index1)); assertFalse(compositePersistence.supportsIndex(index2)); }