### Question:
DatabaseConfigService extends AbstractArchivistService<DatabaseConfig> implements ResourceIdProvider, ResourceBasedCrnProvider { public Set<DatabaseConfig> deleteMultipleByCrn(Set<String> resourceCrns) { Set<Crn> parsedCrns = resourceCrns.stream() .map(Crn::safeFromString) .collect(Collectors.toSet()); Set<DatabaseConfig> foundDatabaseConfigs = repository.findByResourceCrnIn(parsedCrns); if (resourceCrns.size() != foundDatabaseConfigs.size()) { Set<String> notFoundDatabaseConfigs = Sets.difference(resourceCrns, foundDatabaseConfigs.stream() .map(DatabaseConfig::getResourceCrn) .map(Object::toString) .collect(Collectors.toSet())); throw new NotFoundException( String.format("Database(s) not found: %s", String.join(", ", notFoundDatabaseConfigs))); } return foundDatabaseConfigs.stream() .map(this::delete) .collect(Collectors.toSet()); }  Set<DatabaseConfig> findAll(String environmentCrn); DatabaseConfig register(DatabaseConfig configToSave, boolean test); DatabaseConfig getByCrn(String resourceCrn); DatabaseConfig getByName(String name, String environmentCrn); DatabaseConfig getByName(String name); Set<DatabaseConfig> deleteMultipleByCrn(Set<String> resourceCrns); DatabaseConfig deleteByCrn(String resourceCrn); DatabaseConfig deleteByName(String name, String environmentCrn); String testConnection(String databaseConfigName, String environmentCrn); String testConnection(DatabaseConfig config); @Override DatabaseConfig delete(DatabaseConfig databaseConfig); DatabaseConfig delete(DatabaseConfig databaseConfig, boolean force, boolean skipDeletionOnServer); @Override JpaRepository repository(); @Override Long getResourceIdByResourceCrn(String resourceCrn); @Override Long getResourceIdByResourceName(String resourceName); @Override AuthorizationResourceType getResourceType(); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); @Override List<String> getResourceCrnsInAccount();  }### Answer:
@Test public void testDeleteMultipleByCrn() { Set<DatabaseConfig> databaseConfigs = new HashSet<>(); databaseConfigs.add(getDatabaseConfig(ResourceStatus.USER_MANAGED, DATABASE_NAME)); databaseConfigs.add(getDatabaseConfig(ResourceStatus.USER_MANAGED, DATABASE_NAME2)); Set<Crn> databasesToDelete = Set.of(DB_CRN, DB2_CRN); when(repository.findByResourceCrnIn(databasesToDelete)).thenReturn(databaseConfigs); underTest.deleteMultipleByCrn(Set.of(DB_CRN_STRING, DB2_CRN_STRING)); assertThat(databaseConfigs, Every.everyItem(hasProperty("archived", is(true)))); }
@Test public void testDeleteMultipleByCrnWhenNotFound() { thrown.expect(NotFoundException.class); thrown.expectMessage(String.format("Database(s) not found: %s", DB2_CRN_STRING)); DatabaseConfig databaseConfig = getDatabaseConfig(ResourceStatus.SERVICE_MANAGED, DATABASE_NAME); databaseConfig.setResourceCrn(DB_CRN); Set<Crn> databasesToDelete = Set.of(DB_CRN, DB2_CRN); when(repository.findByResourceCrnIn(databasesToDelete)).thenReturn(Set.of(databaseConfig)); underTest.deleteMultipleByCrn(Set.of(DB_CRN_STRING, DB2_CRN_STRING)); assertFalse(databaseConfig.isArchived()); }