ExternalInterfaceServiceImpl implements ExternalInterfaceService { @Override public ExternalInterfaceKeys getExternalInterfaces() { ExternalInterfaceKeys externalInterfaceKeys = new ExternalInterfaceKeys(); externalInterfaceKeys.getExternalInterfaceKeys() .addAll(externalInterfaceDao.getExternalInterfaces().stream().map(ExternalInterfaceKey::new).collect(Collectors.toList())); return externalInterfaceKeys; }  @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 testGetExternalInterfaces() { when(externalInterfaceDao.getExternalInterfaces()).thenReturn(ALL_EXTERNAL_INTERFACE_NAMES); ExternalInterfaceKeys externalInterfaceKeys = externalInterfaceService.getExternalInterfaces(); assertNotNull(externalInterfaceKeys); List<ExternalInterfaceKey> externalInterfaceKeyList = externalInterfaceKeys.getExternalInterfaceKeys(); assertEquals(ALL_EXTERNAL_INTERFACE_NAMES.size(), externalInterfaceKeyList.size()); assertEquals(EXTERNAL_INTERFACE, externalInterfaceKeyList.get(0).getExternalInterfaceName()); assertEquals(EXTERNAL_INTERFACE_2, externalInterfaceKeyList.get(1).getExternalInterfaceName()); assertEquals(EXTERNAL_INTERFACE_3, externalInterfaceKeyList.get(2).getExternalInterfaceName()); verify(externalInterfaceDao).getExternalInterfaces(); verifyNoMoreInteractionsHelper(); }
@Test public void testGetExternalInterfacesEmptyList() { when(externalInterfaceDao.getExternalInterfaces()).thenReturn(Collections.emptyList()); ExternalInterfaceKeys externalInterfaceKeys = externalInterfaceService.getExternalInterfaces(); assertNotNull(externalInterfaceKeys); assertEquals(0, externalInterfaceKeys.getExternalInterfaceKeys().size()); verify(externalInterfaceDao).getExternalInterfaces(); verifyNoMoreInteractionsHelper(); }