diff options
author | Manoop Talasila <talasila@research.att.com> | 2018-09-25 19:09:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-25 19:09:23 +0000 |
commit | 50221092cd81d1683f52dfd04b38da99b8d05b95 (patch) | |
tree | 716ec98db02ade2cf0954f6f686c9ea81fee7d74 /ecomp-sdk/epsdk-aaf/src/test/java | |
parent | 1f1b81f57141704a3c596f602a1f224912180e72 (diff) | |
parent | 86f0f7900d58942e37564ecbb8926af6d9a5e541 (diff) |
Merge "aded tst cases to ExternalAccessUserRoleDetailTest"
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/test/java')
-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)); + + } } |