summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-24 19:04:43 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-09-24 19:06:29 +0530
commit86f0f7900d58942e37564ecbb8926af6d9a5e541 (patch)
tree035d7f2e83330e6fd3288e09b1948916d92ab9ac /ecomp-sdk
parentf6e512bb85978cd8320ee4ea2ed4da234fa0d10b (diff)
aded tst cases to ExternalAccessUserRoleDetailTest
to increase code coverage Issue-ID: PORTAL-273 Change-Id: If38e7a5e71ef5ba38bae003c026c44503cf1daa2 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java91
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));
+
+ }
}