BusinessObjectFormatExternalInterfaceHelper { public void validateAndTrimBusinessObjectFormatExternalInterfaceCreateRequest( BusinessObjectFormatExternalInterfaceCreateRequest businessObjectFormatExternalInterfaceCreateRequest) { Assert.notNull(businessObjectFormatExternalInterfaceCreateRequest, "A business object format to external interface mapping create request must be specified."); validateAndTrimBusinessObjectFormatExternalInterfaceKey( businessObjectFormatExternalInterfaceCreateRequest.getBusinessObjectFormatExternalInterfaceKey()); }  BusinessObjectFormatExternalInterface createBusinessObjectFormatExternalInterfaceFromEntity(
        BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity); BusinessObjectFormatExternalInterfaceKey createBusinessObjectFormatExternalInterfaceKeyFromEntity(
        BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity); void validateAndTrimBusinessObjectFormatExternalInterfaceCreateRequest(
        BusinessObjectFormatExternalInterfaceCreateRequest businessObjectFormatExternalInterfaceCreateRequest); void validateAndTrimBusinessObjectFormatExternalInterfaceKey(BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey);  }
@Test public void testValidateAndTrimBusinessObjectFormatExternalInterfaceCreateRequest() { BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey = new BusinessObjectFormatExternalInterfaceKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE); BusinessObjectFormatExternalInterfaceCreateRequest businessObjectFormatExternalInterfaceCreateRequest = new BusinessObjectFormatExternalInterfaceCreateRequest(businessObjectFormatExternalInterfaceKey); 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("An", "external interface name", EXTERNAL_INTERFACE)).thenReturn(EXTERNAL_INTERFACE_2); businessObjectFormatExternalInterfaceHelper .validateAndTrimBusinessObjectFormatExternalInterfaceCreateRequest(businessObjectFormatExternalInterfaceCreateRequest); assertEquals(new BusinessObjectFormatExternalInterfaceCreateRequest( new BusinessObjectFormatExternalInterfaceKey(NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, EXTERNAL_INTERFACE_2)), businessObjectFormatExternalInterfaceCreateRequest); 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("An", "external interface name", EXTERNAL_INTERFACE); verifyNoMoreInteractions(alternateKeyHelper); }
@Test public void testValidateAndTrimBusinessObjectFormatExternalInterfaceCreateRequestBusinessObjectFormatExternalInterfaceCreateRequestIsNull() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("A business object format to external interface mapping create request must be specified."); businessObjectFormatExternalInterfaceHelper.validateAndTrimBusinessObjectFormatExternalInterfaceCreateRequest(null); verifyNoMoreInteractions(alternateKeyHelper); }