summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-common/src')
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java200
1 files changed, 160 insertions, 40 deletions
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java
index 96089cd7..d40bd420 100644
--- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -50,45 +52,163 @@ import java.util.Set;
import org.junit.Test;
public class EPUserAppRolesRequestTest {
-
- private static final String TEST="test";
- Date date=new Date();
-
-
- @Test
- public void testEpUserAppRoles() {
- EPUserAppRolesRequest request=new EPUserAppRolesRequest();
- request=buildEPUserAppRolesRequest(request);
- EPUserAppRolesRequest request1=new EPUserAppRolesRequest();
- request1=buildEPUserAppRolesRequest(request1);
-
- assertEquals(request.getRequestStatus(), "test");
- request.getAppId();
- request.getUserId();
- assertEquals(request.getCreated(),date);
- assertEquals(request.getCreatedDate(),date);
- assertEquals(request.getUpdatedDate(),date);
- assertNotNull(request.getEpRequestIdDetail());
- assertEquals(request.hashCode(), request1.hashCode());
- assertTrue(request.equals(request1));
- assertNotNull(request.toString());
-
-
- }
- private EPUserAppRolesRequest buildEPUserAppRolesRequest(EPUserAppRolesRequest request) {
- request.setUserId(1l);
- request.setAppId(1l);
- request.setCreated(date);
- request.setCreatedDate(date);
- request.setUpdatedDate(date);
- request.setRequestStatus(TEST);
- Set<EPUserAppRolesRequestDetail> epRequestIdDetail=new HashSet<>();
- EPUserAppRolesRequestDetail detail=new EPUserAppRolesRequestDetail();
- detail.setId(1l);
- epRequestIdDetail.add(detail);
- request.setEpRequestIdDetail(epRequestIdDetail);
-
- return request;
- }
+
+ private static final String TEST="test";
+ Date date=new Date();
+
+
+ @Test
+ public void testEpUserAppRoles() {
+ EPUserAppRolesRequest request=new EPUserAppRolesRequest();
+ request=buildEPUserAppRolesRequest(request);
+ EPUserAppRolesRequest request1=new EPUserAppRolesRequest();
+ request1=buildEPUserAppRolesRequest(request1);
+
+ assertEquals(request.getRequestStatus(), "test");
+ request.getAppId();
+ request.getUserId();
+ assertEquals(request.getCreated(),date);
+ assertEquals(request.getCreatedDate(),date);
+ assertEquals(request.getUpdatedDate(),date);
+ assertNotNull(request.getEpRequestIdDetail());
+ assertEquals(request.hashCode(), request1.hashCode());
+ assertTrue(request.equals(request1));
+ assertNotNull(request.toString());
+
+ request.setAppId(null);
+ request1.setAppId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 54321);
+ request1.setAppId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(null);
+ request1.setCreatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ Date requstDate = new Date();
+ requstDate.setYear(2000);
+ request.setCreatedDate(requstDate);
+ request1.setCreatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(null);
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ HashSet<EPUserAppRolesRequestDetail> details = new HashSet<EPUserAppRolesRequestDetail>();
+ details.add(new EPUserAppRolesRequestDetail());
+ request.setEpRequestIdDetail(details);
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ assertFalse(request.equals(request1));
+
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus(null);
+ request1.setRequestStatus("notnull");
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("status");
+ request1.setRequestStatus("notnull");
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ request.setUpdatedDate(null);
+ request1.setUpdatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ Date date = new Date();
+ date.setYear(2000);
+ request.setUpdatedDate(date);
+ request1.setUpdatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ request.setUpdatedDate(new Date());
+ request1.setUpdatedDate(new Date());
+ request.setUserId(null);
+ request1.setUserId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ request.setUpdatedDate(new Date());
+ request1.setUpdatedDate(new Date());
+ request.setUserId((long) 54321);
+ request1.setUserId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ assertFalse(request.equals(this));
+ assertFalse(request.equals(null));
+
+ }
+ private EPUserAppRolesRequest buildEPUserAppRolesRequest(EPUserAppRolesRequest request) {
+ request.setUserId(1l);
+ request.setAppId(1l);
+ request.setCreated(date);
+ request.setCreatedDate(date);
+ request.setUpdatedDate(date);
+ request.setRequestStatus(TEST);
+ Set<EPUserAppRolesRequestDetail> epRequestIdDetail=new HashSet<>();
+ EPUserAppRolesRequestDetail detail=new EPUserAppRolesRequestDetail();
+ detail.setId(1l);
+ epRequestIdDetail.add(detail);
+ request.setEpRequestIdDetail(epRequestIdDetail);
+
+ return request;
+ }
}