AxiomValueGatherer { void update(Connection connection) { try { connection.update(axiomDescriptor); if (typesToAdd != null) { connection.types().addTypes(axiomDescriptor.getSubject(), typesContext, typesToAdd); } if (typesToRemove != null) { connection.types().removeTypes(axiomDescriptor.getSubject(), typesContext, typesToRemove); } if (propertiesToAdd != null) { connection.properties().addProperties(axiomDescriptor.getSubject(), propertiesContext, propertiesToAdd); } if (propertiesToRemove != null) { connection.properties() .removeProperties(axiomDescriptor.getSubject(), propertiesContext, propertiesToRemove); } for (SimpleListValueDescriptor d : simpleListDescriptors) { connection.lists().updateSimpleList(d); } for (ReferencedListValueDescriptor d : referencedListDescriptors) { connection.lists().updateReferencedList(d); } } catch (OntoDriverException e) { throw new StorageAccessException(e); } } AxiomValueGatherer(NamedResource subject, URI subjectContext);   }
@Test void testUpdate() 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 Set<URI> typesToRemove = generateTypes(); sut.removeTypes(typesToRemove, null); final Map<Assertion, Set<Value<?>>> propsToAdd = propertiesToAdd(); sut.addProperties(propsToAdd, null); final Map<Assertion, Set<Value<?>>> propsToRemove = propertiesToRemove(); sut.removeProperties(propsToRemove, null); sut.update(connectionMock); verify(connectionMock).update(any(AxiomValueDescriptor.class)); verify(listsMock).updateSimpleList(simpleD); verify(listsMock).updateReferencedList(referencedD); verify(typesMock).addTypes(SUBJECT, null, typesToAdd); verify(typesMock).removeTypes(SUBJECT, null, typesToRemove); verify(propertiesMock).addProperties(SUBJECT, null, propsToAdd); verify(propertiesMock).removeProperties(SUBJECT, null, propsToRemove); }