BusinessObjectDataInitiateDestroyHelperServiceImpl implements BusinessObjectDataInitiateDestroyHelperService { void validateStorage(StorageEntity storageEntity) { if (!storageHelper .getBooleanStorageAttributeValueByName(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX), storageEntity, false, true)) { throw new IllegalStateException(String.format("Path prefix validation must be enabled on \"%s\" storage.", storageEntity.getName())); } }  @PublishNotificationMessages @Override @Transactional(propagation = Propagation.REQUIRES_NEW) BusinessObjectData executeInitiateDestroyAfterStep(BusinessObjectDataDestroyDto businessObjectDataDestroyDto); @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) void executeS3SpecificSteps(BusinessObjectDataDestroyDto businessObjectDataDestroyDto); @PublishNotificationMessages @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void prepareToInitiateDestroy(BusinessObjectDataDestroyDto businessObjectDataDestroyDto, BusinessObjectDataKey businessObjectDataKey);  }
@Test public void testValidateStorageValidatePathPrefixNotEnabled() { StorageEntity storageEntity = new StorageEntity(); storageEntity.setName(STORAGE_NAME); when(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX)).thenReturn(S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX); when(storageHelper.getBooleanStorageAttributeValueByName(S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX, storageEntity, false, true)).thenReturn(false); try { businessObjectDataInitiateDestroyHelperServiceImpl.validateStorage(storageEntity); fail(); } catch (IllegalStateException e) { assertEquals(String.format("Path prefix validation must be enabled on \"%s\" storage.", STORAGE_NAME), e.getMessage()); } verify(configurationHelper).getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX); verify(storageHelper).getBooleanStorageAttributeValueByName(S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX, storageEntity, false, true); verifyNoMoreInteractionsHelper(); }