ConnectionWrapper implements Wrapper { @Override public <T> T unwrap(Class<T> cls) { try { return connection.unwrap(cls); } catch (OntoDriverException e) { throw new OWLPersistenceException(e); } } ConnectionWrapper(Connection connection); boolean contains(Object identifier, Class<T> cls, Descriptor descriptor); T find(LoadingParameters<T> loadingParameters); T getReference(LoadingParameters<T> loadingParameters); void merge(T entity, Field field, Descriptor descriptor); void persist(Object identifier, T entity, Descriptor descriptor); void remove(Object identifier, Class<T> cls, Descriptor descriptor); void loadFieldValue(T entity, Field field, Descriptor descriptor); void commit(); void rollback(); void close(); boolean isConsistent(URI context); List<URI> getContexts(); Statement createStatement(); @Override T unwrap(Class<T> cls);  }
@Test void unwrapCallIsForwardedToConnection() throws Exception { connectionWrapper.unwrap(Object.class); verify(connectionMock).unwrap(Object.class); }
@Test void throwsPersistenceExceptionWhenUnwrapCallFailsOnConnection() throws Exception { when(connectionMock.unwrap(Object.class)).thenThrow(new OntoDriverException()); assertThrows(OWLPersistenceException.class, () -> connectionWrapper.unwrap(Object.class)); }