@Test
public void testCreateExternalInterface()
{

    when(externalInterfaceDao.getExternalInterfaceByName(EXTERNAL_INTERFACE)).thenReturn(null);
    when(alternateKeyHelper.validateStringParameter(anyString(), anyString(), anyString())).thenReturn(EXTERNAL_INTERFACE);
    when(alternateKeyHelper.validateStringParameter(anyString(), anyString())).thenReturn(DISPLAY_NAME_FIELD);
    when(externalInterfaceDao.saveAndRefresh(any(ExternalInterfaceEntity.class))).thenReturn(EXTERNAL_INTERFACE_ENTITY);
    ExternalInterfaceKey externalInterfaceKey = new ExternalInterfaceKey(EXTERNAL_INTERFACE);
    ExternalInterfaceCreateRequest externalInterfaceCreateRequest =
        new ExternalInterfaceCreateRequest(externalInterfaceKey, DISPLAY_NAME_FIELD, DESCRIPTION);
    ExternalInterface externalInterface = externalInterfaceService.createExternalInterface(externalInterfaceCreateRequest);
    assertEquals(EXTERNAL_INTERFACE, externalInterface.getExternalInterfaceKey().getExternalInterfaceName());
    verify(alternateKeyHelper).validateStringParameter("An", "external interface name", EXTERNAL_INTERFACE);
    verify(alternateKeyHelper).validateStringParameter("display name", DISPLAY_NAME_FIELD);
    verify(externalInterfaceDao).getExternalInterfaceByName(EXTERNAL_INTERFACE);
    verify(externalInterfaceDao).saveAndRefresh(any(ExternalInterfaceEntity.class));
    verifyNoMoreInteractionsHelper();
}