diff options
author | Manoop Talasila <talasila@research.att.com> | 2018-10-09 19:39:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-09 19:39:15 +0000 |
commit | c562e26bcd8f9147fd24ca4da9c5dfe7caea0199 (patch) | |
tree | 5d1f0b4492cc290dc193dce62a223a9f9cfa7138 /ecomp-portal-BE-common | |
parent | 963c028ca9d50a786b656014f021b080a7e046f5 (diff) | |
parent | 029e53a3d0fc268f695fe134559dd7f388efc355 (diff) |
Merge "test equality in EPUserAppRolesRequestTest.java"
Diffstat (limited to 'ecomp-portal-BE-common')
-rw-r--r-- | ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java | 200 |
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; + } } |