AxiomValueGatherer { void persist(Connection connection) { try { connection.persist(axiomDescriptor); if (typesToAdd != null) { connection.types().addTypes(axiomDescriptor.getSubject(), typesContext, typesToAdd); } if (propertiesToAdd != null) { connection.properties().addProperties(axiomDescriptor.getSubject(), propertiesContext, propertiesToAdd); } for (SimpleListValueDescriptor d : simpleListDescriptors) { connection.lists().persistSimpleList(d); } for (ReferencedListValueDescriptor d : referencedListDescriptors) { connection.lists().persistReferencedList(d); } } catch (OntoDriverException e) { throw new StorageAccessException(e); } } AxiomValueGatherer(NamedResource subject, URI subjectContext);   }
@Test void testPersist() throws Exception { addValue(); final SimpleListValueDescriptor simpleD = mock(SimpleListValueDescriptor.class); final ReferencedListValueDescriptor referencedD = mock(ReferencedListValueDescriptor.class); sut.addSimpleListValues(simpleD); sut.addReferencedListValues(referencedD); final Set<URI> typesToAdd = generateTypes(); sut.addTypes(typesToAdd, null); final Map<Assertion, Set<Value<?>>> propsToAdd = propertiesToAdd(); sut.addProperties(propsToAdd, null); sut.persist(connectionMock); verify(connectionMock).persist(any(AxiomValueDescriptor.class)); verify(listsMock).persistSimpleList(simpleD); verify(listsMock).persistReferencedList(referencedD); verify(typesMock).addTypes(SUBJECT, null, typesToAdd); verify(propertiesMock).addProperties(SUBJECT, null, propsToAdd); }