JenaAdapter implements Wrapper { void persist(AxiomValueDescriptor descriptor) { beginTransactionIfNotActive(); new AxiomSaver(connector).saveAxioms(descriptor); } JenaAdapter(StorageConnector connector, InferredStorageConnector inferenceConnector); ListHandler<SimpleListDescriptor, SimpleListValueDescriptor> simpleListHandler(); ListHandler<ReferencedListDescriptor, ReferencedListValueDescriptor> referencedListHandler(); @Override T unwrap(Class<T> cls);  }
@Test void persistBeginsTransaction() { final AxiomValueDescriptor descriptor = new AxiomValueDescriptor(SUBJECT); adapter.persist(descriptor); verify(connectorMock).begin(); }
@Test void persistGeneratesStatementsAndPassesThemToConnectorForPersist() { final AxiomValueDescriptor descriptor = new AxiomValueDescriptor(SUBJECT); final Assertion a = Assertion.createClassAssertion(false); final NamedResource type = NamedResource.create(Generator.generateUri()); descriptor.addAssertionValue(a, new Value<>(type)); adapter.persist(descriptor); final ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); verify(connectorMock).add(captor.capture(), eq(null)); final List<Statement> arg = captor.getValue(); assertEquals(1, arg.size()); }