* ===================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@Mock
DataAccessService dataAccessService = new DataAccessServiceImpl();
+ @Mock
+ ExternalAccessRolesService externalAccessRolesService;
+
@Mock
EPAppCommonServiceImpl epAppCommonServiceImpl = new EPAppCommonServiceImpl();
assertFalse(actual);
}
+ @Test
+ public void isAccountAdminUserNull() {
+ boolean actual = adminRolesServiceImpl.isAccountAdmin(null);
+ assertFalse(actual);
+ }
+
+ @Test
+ public void isRoleAdminTest() {
+ EPUser user = mockUser.mockEPUser();
+ List<String> roles = new ArrayList<>();
+ roles.add("approver\\|");
+ Mockito.when(dataAccessService.executeNamedQuery(
+ Matchers.eq("getRoleFunctionsOfUserforAlltheApplications"), Matchers.any(), Matchers.any()))
+ .thenReturn(roles);
+ Mockito.when(externalAccessRolesService.getFunctionCodeType(Matchers.anyString())).thenReturn("approver");
+ boolean actual = adminRolesServiceImpl.isRoleAdmin(user);
+ assertTrue(actual);
+ }
+
@Test
public void isUserTest() {
EPUser user = mockUser.mockEPUser();