@Test
public void applyDifferenceTest() {

    // Setup:
    IRI sub = VALUE_FACTORY.createIRI("http://test.com#sub");
    Statement existing = VALUE_FACTORY.createStatement(sub, titleIRI, VALUE_FACTORY.createLiteral("Existing"));
    Statement toDelete = VALUE_FACTORY.createStatement(sub, titleIRI, VALUE_FACTORY.createLiteral("Delete"));
    Statement toAdd = VALUE_FACTORY.createStatement(sub, titleIRI, VALUE_FACTORY.createLiteral("Add"));
    Difference diff = new Difference.Builder()
            .additions(MODEL_FACTORY.createModel(Collections.singleton(toAdd)))
            .deletions(MODEL_FACTORY.createModel(Collections.singleton(toDelete))).build();
    Model model = MODEL_FACTORY.createModel(Stream.of(existing, toDelete).collect(Collectors.toList()));
    Model result = service.applyDifference(model, diff);
    assertTrue(result.contains(existing));
    assertTrue(result.contains(toAdd));
    assertFalse(result.contains(toDelete));
}