OwlapiAdapter { public <T> T unwrap(Class<T> cls) throws OwlapiDriverException { startTransactionIfNotActive(); if (cls.isAssignableFrom(this.getClass())) { return cls.cast(this); } else if (cls.isAssignableFrom(OWLOntology.class)) { return cls.cast(ontologySnapshot.getOntology()); } throw new OwlapiDriverException("Unsupported type " + cls); } OwlapiAdapter(Connector connector); void addTransactionalChanges(Collection<OWLOntologyChange> changes); ListHandler<SimpleListDescriptor, SimpleListValueDescriptor> getSimpleListHandler(); ListHandler<ReferencedListDescriptor, ReferencedListValueDescriptor> getReferencedListHandler(); OwlapiStatement createStatement(OwlapiConnection connection); OwlapiPreparedStatement prepareStatement(String statement, OwlapiConnection connection); T unwrap(Class<T> cls);  }
@Test void unwrapReturnsTheAdapterWhenClassMatches() throws Exception { assertSame(adapter, adapter.unwrap(OwlapiAdapter.class)); }
@Test void unwrapReturnsOntologySnapshotWhenOwlOntologyClassIsPassedIn() throws Exception { assertSame(ontology, adapter.unwrap(OWLOntology.class)); }
@Test void throwsDriverExceptionWhenUnsupportedClassIsPassedToUnwrap() { assertThrows(OwlapiDriverException.class, () -> adapter.unwrap(Connection.class)); }