CatalogProvUtilsImpl implements CatalogProvUtils { @Override public void endDeleteActivity(DeleteActivity deleteActivity, Record record) { Entity recordEntity = entityFactory.getExisting(record.getResource(), deleteActivity.getModel()).orElseThrow(() -> new IllegalStateException("No Entity found for record.")); recordEntity.addInvalidatedAtTime(OffsetDateTime.now()); finalizeActivity(deleteActivity); record.getProperty(vf.createIRI(_Thing.title_IRI)) .ifPresent(v -> recordEntity.addProperty(v, vf.createIRI(_Thing.title_IRI))); provenanceService.updateActivity(deleteActivity); }  @Override CreateActivity startCreateActivity(User user); @Override void endCreateActivity(CreateActivity createActivity, Resource recordIRI); @Override DeleteActivity startDeleteActivity(User user, Resource recordIri); @Override void endDeleteActivity(DeleteActivity deleteActivity, Record record); @Override void removeActivity(Activity activity);  }
@Test public void endDeleteActivityTest() throws Exception { entity.addProperty(VALUE_FACTORY.createLiteral("system"), VALUE_FACTORY.createIRI(predAtLocation)); deleteActivity.addInvalidated(entity); deleteActivity.getModel().addAll(entity.getModel()); utils.endDeleteActivity(deleteActivity, record); verify(provenanceService).updateActivity(deleteActivity); assertTrue(deleteActivity.getModel().contains(deleteActivity.getResource(), VALUE_FACTORY.createIRI(Activity.endedAtTime_IRI), null)); assertEquals(1, deleteActivity.getInvalidated().size()); Entity resultEntity = deleteActivity.getInvalidated().iterator().next(); assertTrue(resultEntity.getModel().contains(resultEntity.getResource(), VALUE_FACTORY.createIRI(Entity.invalidatedAtTime_IRI), null)); assertTrue(resultEntity.getModel().contains(resultEntity.getResource(), VALUE_FACTORY.createIRI(_Thing.title_IRI), VALUE_FACTORY.createLiteral("Test Record"))); }