ExternalInterfaceServiceImpl implements ExternalInterfaceService { void validateExternalInterfaceUpdateRequest(ExternalInterfaceUpdateRequest request) throws IllegalArgumentException { Assert.notNull(request, "An external interface update request must be specified."); 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 testValidateExternalInterfaceUpdateRequestExtraSpaces() { when(alternateKeyHelper.validateStringParameter(anyString(), anyString())).thenReturn(DISPLAY_NAME_FIELD); assertEquals(DISPLAY_NAME_FIELD_WITH_EXTRA_SPACES, EXTERNAL_INTERFACE_UPDATE_REQUEST_WITH_EXTRA_SPACES_IN_DISPLAY_NAME.getDisplayName()); externalInterfaceService.validateExternalInterfaceUpdateRequest(EXTERNAL_INTERFACE_UPDATE_REQUEST_WITH_EXTRA_SPACES_IN_DISPLAY_NAME); assertEquals(DISPLAY_NAME_FIELD, EXTERNAL_INTERFACE_UPDATE_REQUEST_WITH_EXTRA_SPACES_IN_DISPLAY_NAME.getDisplayName()); }