WrappingPersistence implements Persistence<O, A> { @Override public boolean supportsIndex(Index<O> index) { return index instanceof OnHeapTypeIndex; } WrappingPersistence(Collection<O> backingCollection);  WrappingPersistence(Collection<O> backingCollection, SimpleAttribute<O, A> primaryKeyAttribute); @Override boolean supportsIndex(Index<O> index); @Override ObjectStore<O> createObjectStore(); @Override void openRequestScopeResources(QueryOptions queryOptions); @Override void closeRequestScopeResources(QueryOptions queryOptions); @Override SimpleAttribute<O, A> getPrimaryKeyAttribute(); static WrappingPersistence<O, A> aroundCollectionOnPrimaryKey(Collection<O> collection, SimpleAttribute<O, A> primaryKeyAttribute); @SuppressWarnings("unchecked") static WrappingPersistence<O, ? extends Comparable> aroundCollection(Collection<O> collection);  }
@Test public void testSupportsIndex() throws Exception { WrappingPersistence<Car, Integer> wrappingPersistence = WrappingPersistence.aroundCollectionOnPrimaryKey(new HashSet<Car>(), Car.CAR_ID); assertTrue(wrappingPersistence.supportsIndex(NavigableIndex.onAttribute(Car.MANUFACTURER))); assertFalse(wrappingPersistence.supportsIndex(DiskIndex.onAttribute(Car.MANUFACTURER))); }