UploadDownloadHelper { public void validateAndTrimDownloadBusinessObjectDataStorageFileSingleInitiationRequest( DownloadBusinessObjectDataStorageFileSingleInitiationRequest downloadBusinessObjectDataStorageFileSingleInitiationRequest) { Assert.notNull(downloadBusinessObjectDataStorageFileSingleInitiationRequest, "A download business object data storage file single initiation request must be specified."); validateAndTrimBusinessObjectDataStorageFileKey( downloadBusinessObjectDataStorageFileSingleInitiationRequest.getBusinessObjectDataStorageFileKey()); }  void validateAndTrimDownloadBusinessObjectDataStorageFileSingleInitiationRequest(
        DownloadBusinessObjectDataStorageFileSingleInitiationRequest downloadBusinessObjectDataStorageFileSingleInitiationRequest); void validateAndTrimBusinessObjectDataStorageFileKey(BusinessObjectDataStorageFileKey businessObjectDataStorageFileKey);  }
@Test public void testValidateAndTrimDownloadBusinessObjectDataStorageFileSingleInitiationRequest() { BusinessObjectDataStorageFileKey businessObjectDataStorageFileKey = new BusinessObjectDataStorageFileKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME, TEST_S3_KEY_PREFIX + "/" + LOCAL_FILE + " "); DownloadBusinessObjectDataStorageFileSingleInitiationRequest downloadBusinessObjectDataStorageFileSingleInitiationRequest = new DownloadBusinessObjectDataStorageFileSingleInitiationRequest(businessObjectDataStorageFileKey); when(alternateKeyHelper.validateStringParameter("namespace", NAMESPACE)).thenReturn(NAMESPACE_2); when(alternateKeyHelper.validateStringParameter("business object definition name", BDEF_NAME)).thenReturn(BDEF_NAME_2); when(alternateKeyHelper.validateStringParameter("business object format usage", FORMAT_USAGE_CODE)).thenReturn(FORMAT_USAGE_CODE_2); when(alternateKeyHelper.validateStringParameter("business object format file type", FORMAT_FILE_TYPE_CODE)).thenReturn(FORMAT_FILE_TYPE_CODE_2); when(alternateKeyHelper.validateStringParameter("partition value", PARTITION_VALUE)).thenReturn(PARTITION_VALUE_2); for (int i = 0; i < SUBPARTITION_VALUES.size(); i++) { when(alternateKeyHelper.validateStringParameter("sub partition value", SUBPARTITION_VALUES.get(i))).thenReturn(SUBPARTITION_VALUES_2.get(i)); } when(alternateKeyHelper.validateStringParameter("storage name", STORAGE_NAME)).thenReturn(STORAGE_NAME_2); uploadDownloadHelper .validateAndTrimDownloadBusinessObjectDataStorageFileSingleInitiationRequest(downloadBusinessObjectDataStorageFileSingleInitiationRequest); assertEquals(new DownloadBusinessObjectDataStorageFileSingleInitiationRequest( new BusinessObjectDataStorageFileKey(NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION, PARTITION_VALUE_2, SUBPARTITION_VALUES_2, DATA_VERSION, STORAGE_NAME_2, TEST_S3_KEY_PREFIX + "/" + LOCAL_FILE)), downloadBusinessObjectDataStorageFileSingleInitiationRequest); verify(alternateKeyHelper).validateStringParameter("namespace", NAMESPACE); verify(alternateKeyHelper).validateStringParameter("business object definition name", BDEF_NAME); verify(alternateKeyHelper).validateStringParameter("business object format usage", FORMAT_USAGE_CODE); verify(alternateKeyHelper).validateStringParameter("business object format file type", FORMAT_FILE_TYPE_CODE); verify(alternateKeyHelper).validateStringParameter("partition value", PARTITION_VALUE); for (String subPartitionValue : SUBPARTITION_VALUES) { verify(alternateKeyHelper).validateStringParameter("sub partition value", subPartitionValue); } verify(alternateKeyHelper).validateStringParameter("storage name", STORAGE_NAME); verifyNoMoreInteractions(alternateKeyHelper); }
@Test public void testValidateAndTrimDownloadBusinessObjectDataStorageFileSingleInitiationRequestIsNull() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("A download business object data storage file single initiation request must be specified."); uploadDownloadHelper.validateAndTrimDownloadBusinessObjectDataStorageFileSingleInitiationRequest(null); verifyNoMoreInteractions(alternateKeyHelper); }