SecurityFunctionServiceImpl implements SecurityFunctionService { @Override public SecurityFunctionKeys getSecurityFunctions() { SecurityFunctionKeys securityFunctionKeys = new SecurityFunctionKeys(); securityFunctionKeys.getSecurityFunctionKeys() .addAll(securityFunctionDao.getSecurityFunctions().stream().map(SecurityFunctionKey::new).collect(Collectors.toList())); return securityFunctionKeys; }  @Override SecurityFunction createSecurityFunction(SecurityFunctionCreateRequest request); @Override SecurityFunction getSecurityFunction(SecurityFunctionKey securityFunctionKey); @Override SecurityFunction deleteSecurityFunction(SecurityFunctionKey securityFunctionKey); @Override SecurityFunctionKeys getSecurityFunctions();  }
@Test public void testGetSecurityFunctions() { when(securityFunctionDao.getSecurityFunctions()).thenReturn(ALL_SECURITY_FUNCTION_NAMES); SecurityFunctionKeys securityFunctionKeys = securityFunctionService.getSecurityFunctions(); assertNotNull(securityFunctionKeys); List<SecurityFunctionKey> securityFunctionKeyList = securityFunctionKeys.getSecurityFunctionKeys(); assertEquals(ALL_SECURITY_FUNCTION_NAMES.size(), securityFunctionKeyList.size()); assertEquals(SECURITY_FUNCTION, securityFunctionKeyList.get(0).getSecurityFunctionName()); assertEquals(SECURITY_FUNCTION_2, securityFunctionKeyList.get(1).getSecurityFunctionName()); assertEquals(SECURITY_FUNCTION_3, securityFunctionKeyList.get(2).getSecurityFunctionName()); verify(securityFunctionDao).getSecurityFunctions(); verifyNoMoreInteractionsHelper(); }
@Test public void testGetSecurityFunctionsEmptyList() { when(securityFunctionDao.getSecurityFunctions()).thenReturn(Collections.emptyList()); SecurityFunctionKeys securityFunctionKeys = securityFunctionService.getSecurityFunctions(); assertNotNull(securityFunctionKeys); assertEquals(0, securityFunctionKeys.getSecurityFunctionKeys().size()); verify(securityFunctionDao).getSecurityFunctions(); verifyNoMoreInteractionsHelper(); }