JenaAdapter implements Wrapper { @Override public <T> T unwrap(Class<T> cls) throws OntoDriverException { if (cls.isAssignableFrom(getClass())) { return cls.cast(this); } return connector.unwrap(cls); } JenaAdapter(StorageConnector connector, InferredStorageConnector inferenceConnector); ListHandler<SimpleListDescriptor, SimpleListValueDescriptor> simpleListHandler(); ListHandler<ReferencedListDescriptor, ReferencedListValueDescriptor> referencedListHandler(); @Override T unwrap(Class<T> cls);  }
@Test void unwrapReturnsAdapterInstanceWhenTargetClassMatches() throws Exception { final JenaAdapter result = adapter.unwrap(JenaAdapter.class); assertSame(adapter, result); }
@Test void unwrapPassesCallToStorageConnectorWhenTargetClassDoesNotMatch() throws Exception { adapter.unwrap(StorageConnector.class); verify(connectorMock).unwrap(StorageConnector.class); }