use of org.finra.herd.model.api.xml.UploadSingleInitiationRequest in project herd by FINRAOS.
the class UploadDownloadServiceTest method testInitiateUploadSingleRequiredAttributeMissingValue.
@Test
public void testInitiateUploadSingleRequiredAttributeMissingValue() {
// Create database entities required for testing.
uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting();
// Create and persist a business object data attribute definition entity.
businessObjectFormatDaoTestHelper.createBusinessObjectDataAttributeDefinitionEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
// Try to initiate a single file upload when a required attribute value is not specified.
UploadSingleInitiationRequest request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest();
request.setBusinessObjectDataAttributes(Arrays.asList(new Attribute(ATTRIBUTE_NAME_1_MIXED_CASE, BLANK_TEXT)));
try {
uploadDownloadService.initiateUploadSingle(request);
fail("Should throw an IllegalArgumentException when required attribute value is not specified.");
} catch (IllegalArgumentException e) {
assertEquals(String.format("The business object format has a required attribute \"%s\" which was not specified or has a value which is blank.", ATTRIBUTE_NAME_1_MIXED_CASE), e.getMessage());
}
}
Aggregations