ServerSession extends AbstractSession implements Wrapper { public void close() { if (!runningTransactions.isEmpty()) { LOG.warn("There are still transactions running. Marking them for rollback."); runningTransactions.keySet().stream().filter(EntityTransaction::isActive) .forEach(EntityTransaction::setRollbackOnly); } if (storageAccessor != null && storageAccessor.isOpen()) { try { storageAccessor.close(); } catch (OntoDriverException e) { LOG.error("Exception caught when closing the storage accessor.", e); } } liveObjectCache.close(); } ServerSession();  ServerSession(OntologyStorageProperties storageProperties, Configuration configuration,
                         MetamodelImpl metamodel); @Override UnitOfWork acquireUnitOfWork(); @Override CacheManager getLiveObjectCache(); void transactionStarted(EntityTransaction t, AbstractEntityManager em); void transactionFinished(EntityTransaction t); void close(); @Override void removeObjectFromCache(Object object, URI context); @Override MetamodelImpl getMetamodel(); @Override boolean isEntityType(Class<?> cls); @Override NamedQueryManager getNamedQueryManager(); @Override ResultSetMappingManager getResultSetMappingManager(); @Override T unwrap(Class<T> cls);  }
@Test public void testClose() { final EntityTransaction et = mock(EntityTransaction.class); when(et.isActive()).thenReturn(Boolean.TRUE); when(et.isRollbackOnly()).thenReturn(Boolean.FALSE); final AbstractEntityManager em = mock(AbstractEntityManager.class); session.transactionStarted(et, em); session.close(); verify(et).setRollbackOnly(); }