BusinessObjectFormatExternalInterfaceHelper { public void validateAndTrimBusinessObjectFormatExternalInterfaceKey(BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey) { Assert.notNull(businessObjectFormatExternalInterfaceKey, "A business object format to external interface mapping key must be specified."); businessObjectFormatExternalInterfaceKey .setNamespace(alternateKeyHelper.validateStringParameter("namespace", businessObjectFormatExternalInterfaceKey.getNamespace())); businessObjectFormatExternalInterfaceKey.setBusinessObjectDefinitionName(alternateKeyHelper .validateStringParameter("business object definition name", businessObjectFormatExternalInterfaceKey.getBusinessObjectDefinitionName())); businessObjectFormatExternalInterfaceKey.setBusinessObjectFormatUsage(alternateKeyHelper .validateStringParameter("business object format usage", businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatUsage())); businessObjectFormatExternalInterfaceKey.setBusinessObjectFormatFileType(alternateKeyHelper .validateStringParameter("business object format file type", businessObjectFormatExternalInterfaceKey.getBusinessObjectFormatFileType())); businessObjectFormatExternalInterfaceKey.setExternalInterfaceName( alternateKeyHelper.validateStringParameter("An", "external interface name", businessObjectFormatExternalInterfaceKey.getExternalInterfaceName())); }  BusinessObjectFormatExternalInterface createBusinessObjectFormatExternalInterfaceFromEntity(
        BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity); BusinessObjectFormatExternalInterfaceKey createBusinessObjectFormatExternalInterfaceKeyFromEntity(
        BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity); void validateAndTrimBusinessObjectFormatExternalInterfaceCreateRequest(
        BusinessObjectFormatExternalInterfaceCreateRequest businessObjectFormatExternalInterfaceCreateRequest); void validateAndTrimBusinessObjectFormatExternalInterfaceKey(BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey);  }
@Test public void testValidateAndTrimBusinessObjectFormatExternalInterfaceKey() { BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey = new BusinessObjectFormatExternalInterfaceKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, EXTERNAL_INTERFACE); 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.validateAndTrimBusinessObjectFormatExternalInterfaceKey(businessObjectFormatExternalInterfaceKey); assertEquals(new BusinessObjectFormatExternalInterfaceKey(NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, EXTERNAL_INTERFACE_2), businessObjectFormatExternalInterfaceKey); 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 testValidateAndTrimBusinessObjectFormatExternalInterfaceKeyBusinessObjectFormatExternalInterfaceKeyIsNull() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("A business object format to external interface mapping key must be specified."); businessObjectFormatExternalInterfaceHelper.validateAndTrimBusinessObjectFormatExternalInterfaceKey(null); verifyNoMoreInteractions(alternateKeyHelper); }