@Test public void testDelete() { Resource resource = new Resource(); when(clock.getCurrentTimeMillis()).thenReturn(CURRENT_TIME_MILLIS); underTest.delete(resource); assertEquals(CURRENT_TIME_MILLIS, resource.deletionTimestamp); assertTrue(resource.isArchived()); assertTrue(resource.isUnsetRelationsDone()); verify(underTest.repository()).save(resource); }
public T delete(T resource) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); MDCBuilder.buildMdcContext(resource); resource.setArchived(true); resource.setDeletionTimestamp(clock.getCurrentTimeMillis()); resource.unsetRelationsToEntitiesToBeDeleted(); repository().save(resource); MDCBuilder.buildMdcContextFromMap(mdcContextMap); return resource; }
AbstractArchivistService { public T delete(T resource) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); MDCBuilder.buildMdcContext(resource); resource.setArchived(true); resource.setDeletionTimestamp(clock.getCurrentTimeMillis()); resource.unsetRelationsToEntitiesToBeDeleted(); repository().save(resource); MDCBuilder.buildMdcContextFromMap(mdcContextMap); return resource; } }
AbstractArchivistService { public T delete(T resource) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); MDCBuilder.buildMdcContext(resource); resource.setArchived(true); resource.setDeletionTimestamp(clock.getCurrentTimeMillis()); resource.unsetRelationsToEntitiesToBeDeleted(); repository().save(resource); MDCBuilder.buildMdcContextFromMap(mdcContextMap); return resource; }  }
AbstractArchivistService { public T delete(T resource) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); MDCBuilder.buildMdcContext(resource); resource.setArchived(true); resource.setDeletionTimestamp(clock.getCurrentTimeMillis()); resource.unsetRelationsToEntitiesToBeDeleted(); repository().save(resource); MDCBuilder.buildMdcContextFromMap(mdcContextMap); return resource; }  T delete(T resource); abstract JpaRepository repository(); }
AbstractArchivistService { public T delete(T resource) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); MDCBuilder.buildMdcContext(resource); resource.setArchived(true); resource.setDeletionTimestamp(clock.getCurrentTimeMillis()); resource.unsetRelationsToEntitiesToBeDeleted(); repository().save(resource); MDCBuilder.buildMdcContextFromMap(mdcContextMap); return resource; }  T delete(T resource); abstract JpaRepository repository();  }