diff options
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src')
-rw-r--r-- | ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java | 91 |
1 files changed, 61 insertions, 30 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java index 9d20e02c..f0a0a69e 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modifications Copyright (C) 2018 IBM + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -38,6 +40,7 @@ package org.onap.portalsdk.external.authorization.domain; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; @@ -46,36 +49,64 @@ import org.junit.Test; public class ExternalAccessUserRoleDetailTest { - public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetailTest() { - ExternalAccessRole role = new ExternalAccessRole(); - List<ExternalAccessPerms> mockPerms = new ArrayList<>(); - ExternalAccessPerms mockExtPermsTest = new ExternalAccessPerms(); - mockExtPermsTest.setAction("*"); - mockExtPermsTest.setDescription("test_name"); - mockExtPermsTest.setType("test_type"); - mockExtPermsTest.setInstance("test_instance"); - mockPerms.add(mockExtPermsTest); - ExternalAccessRoleDescription mockRoleDesc = new ExternalAccessRoleDescription(); - mockRoleDesc.setActive("true"); - mockRoleDesc.setAppId("1"); - mockRoleDesc.setAppRoleId("1"); - mockRoleDesc.setId("1"); - mockRoleDesc.setPriority("1"); - mockRoleDesc.setName("test"); - mockRoleDesc.setName("com.test.app.rolename"); - role.setPerms(mockPerms); - role.setDescription(mockRoleDesc); - ExternalAccessUserRoleDetail mockExtUserRoleDetailTest = new ExternalAccessUserRoleDetail(role); - return mockExtUserRoleDetailTest; - } + public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetailTest() { + ExternalAccessRole role = new ExternalAccessRole(); + List<ExternalAccessPerms> mockPerms = new ArrayList<>(); + ExternalAccessPerms mockExtPermsTest = new ExternalAccessPerms(); + mockExtPermsTest.setAction("*"); + mockExtPermsTest.setDescription("test_name"); + mockExtPermsTest.setType("test_type"); + mockExtPermsTest.setInstance("test_instance"); + mockPerms.add(mockExtPermsTest); + ExternalAccessRoleDescription mockRoleDesc = new ExternalAccessRoleDescription(); + mockRoleDesc.setActive("true"); + mockRoleDesc.setAppId("1"); + mockRoleDesc.setAppRoleId("1"); + mockRoleDesc.setId("1"); + mockRoleDesc.setPriority("1"); + mockRoleDesc.setName("test"); + mockRoleDesc.setName("com.test.app.rolename"); + role.setPerms(mockPerms); + role.setDescription(mockRoleDesc); + ExternalAccessUserRoleDetail mockExtUserRoleDetailTest = new ExternalAccessUserRoleDetail(role); + return mockExtUserRoleDetailTest; + } - @Test - public void externalAccessPermsTest() { - ExternalAccessUserRoleDetail extUserRoleDetailTest2 = mockExternalAccessUserRoleDetailTest(); - ExternalAccessRole role = extUserRoleDetailTest2.getRole(); - assertEquals(role.getName(), mockExternalAccessUserRoleDetailTest().getRole().getName()); - assertEquals(role.getPerms(), mockExternalAccessUserRoleDetailTest().getRole().getPerms()); - assertEquals(role.getDescription(), mockExternalAccessUserRoleDetailTest().getRole().getDescription()); + @Test + public void externalAccessPermsTest() { + ExternalAccessUserRoleDetail extUserRoleDetailTest2 = mockExternalAccessUserRoleDetailTest(); + ExternalAccessRole role = extUserRoleDetailTest2.getRole(); + assertEquals(role.getName(), mockExternalAccessUserRoleDetailTest().getRole().getName()); + assertEquals(role.getPerms(), mockExternalAccessUserRoleDetailTest().getRole().getPerms()); + assertEquals(role.getDescription(), mockExternalAccessUserRoleDetailTest().getRole().getDescription()); - } + } + + @Test + public void testGetSetRole() { + ExternalAccessUserRoleDetail externalAccessUserRoleDetail= new ExternalAccessUserRoleDetail(); + ExternalAccessRole role = new ExternalAccessRole(); + externalAccessUserRoleDetail.setRole(role); + assertEquals(role, externalAccessUserRoleDetail.getRole()); + } + + @Test + public void testhashCode() { + ExternalAccessUserRoleDetail externalAccessUserRoleDetail= new ExternalAccessUserRoleDetail(); + ExternalAccessRole role = new ExternalAccessRole(); + externalAccessUserRoleDetail.setRole(role); + assertTrue((Integer)(externalAccessUserRoleDetail.hashCode()) instanceof Integer); + + } + + @Test + public void testEquals() { + ExternalAccessUserRoleDetail externalAccessUserRoleDetail= new ExternalAccessUserRoleDetail(); + ExternalAccessUserRoleDetail externalAccessUserRoleDetail1= new ExternalAccessUserRoleDetail(); + ExternalAccessRole role = new ExternalAccessRole(); + externalAccessUserRoleDetail.setRole(role); + externalAccessUserRoleDetail1.setRole(role); + assertTrue(externalAccessUserRoleDetail.equals(externalAccessUserRoleDetail1)); + + } } |