ExternalInterfaceServiceImpl implements ExternalInterfaceService { void validateExternalInterfaceCreateRequest(ExternalInterfaceCreateRequest request) throws IllegalArgumentException { Assert.notNull(request, "An external interface create request must be specified."); ExternalInterfaceKey externalInterfaceKey = request.getExternalInterfaceKey(); externalInterfaceKey.setExternalInterfaceName( alternateKeyHelper.validateStringParameter("An", "external interface name", externalInterfaceKey.getExternalInterfaceName())); request.setDisplayName(alternateKeyHelper.validateStringParameter("display name", request.getDisplayName())); }  @Override ExternalInterface createExternalInterface(ExternalInterfaceCreateRequest request); @Override ExternalInterface getExternalInterface(ExternalInterfaceKey externalInterfaceKey); @Override ExternalInterface deleteExternalInterface(ExternalInterfaceKey externalInterfaceKey); @Override ExternalInterfaceKeys getExternalInterfaces(); @Override ExternalInterface updateExternalInterface(ExternalInterfaceKey externalInterfaceKey, ExternalInterfaceUpdateRequest request);  }
@Test public void testValidateExternalInterfaceCreateRequestExtraSpaces() { when(alternateKeyHelper.validateStringParameter(anyString(), anyString(), anyString())).thenReturn(EXTERNAL_INTERFACE); assertEquals(EXTERNAL_INTERFACE_NAME_WITH_EXTRA_SPACES, EXTERNAL_INTERFACE_CREATE_REQUEST_WITH_EXTRA_SPACES_IN_NAME.getExternalInterfaceKey().getExternalInterfaceName()); externalInterfaceService.validateExternalInterfaceCreateRequest(EXTERNAL_INTERFACE_CREATE_REQUEST_WITH_EXTRA_SPACES_IN_NAME); assertEquals(EXTERNAL_INTERFACE, EXTERNAL_INTERFACE_CREATE_REQUEST_WITH_EXTRA_SPACES_IN_NAME.getExternalInterfaceKey().getExternalInterfaceName()); }