### Question:
DataTerminationService { public void deleteOrphanUserData() { assertGlobalAuditorCredentialsExist(); List<String> deleteSpaceEventsToBeDeleted = getDeleteSpaceEvents(); for (String spaceId : deleteSpaceEventsToBeDeleted) { deleteConfigurationSubscriptionOrphanData(spaceId); deleteConfigurationEntryOrphanData(spaceId); deleteUserOperationsOrphanData(spaceId); deleteSpaceLeftovers(spaceId); } }  void deleteOrphanUserData();  }### Answer:
@Test void testMissingAuditorCredentials() { Exception exception = assertThrows(IllegalStateException.class, () -> dataTerminationService.deleteOrphanUserData()); assertEquals(Messages.MISSING_GLOBAL_AUDITOR_CREDENTIALS, exception.getMessage()); }
@Test void testFailToDeleteSpace() throws FileStorageException { prepareGlobalAuditorCredentials(); prepareCfOptimizedEventsGetter(generateDeletedSpaces(1)); when(configurationEntryService.createQuery()).thenReturn(configurationEntryQuery); when(configurationSubscriptionService.createQuery()).thenReturn(configurationSubscriptionQuery); when(operationService.createQuery()).thenReturn(operationQuery); when(fileService.deleteBySpace(anyString())).thenThrow(new FileStorageException("")); Exception exception = assertThrows(SLException.class, () -> dataTerminationService.deleteOrphanUserData()); assertEquals(Messages.COULD_NOT_DELETE_SPACE_LEFTOVERS, exception.getMessage()); }