DefaultStorageAccessor implements StorageAccessor { @Override public boolean isOpen() { return open; } DefaultStorageAccessor(OntologyStorageProperties storageProperties, Map<String, String> properties); @Override Connection acquireConnection(); @Override void close(); @Override boolean isOpen(); @Override T unwrap(Class<T> cls);  }
@Test void gettingExceptionWhenTryingToCloseDataSourceThrowsStorageAccessExceptionAndClosesAccessor() throws Exception { final DefaultStorageAccessor a = new DefaultStorageAccessor(storageProperties(DATA_SOURCE_CLASS), Collections.emptyMap()); final DataSourceStub ds = getDataSourceStub(a); ds.throwExceptionOnClose(); try { final StorageAccessException ex = assertThrows(StorageAccessException.class, a::close); assertEquals("Error when closing the data source.", ex.getMessage()); } finally { assertFalse(a.isOpen()); } }