@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));
}