X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fportalapp%2Fportal%2Ftransport%2FRemoteRoleV1Test.java;h=ebd117532b6a61d33355abbab8ecd289036dc82f;hb=aa9b320ff93511280cf51b03d38fb9254af6b530;hp=27652d30a538731efddb80efb96c7673ff205210;hpb=fe3a67c11b65d7989a6ef648c3f34eee8abe7394;p=portal.git diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteRoleV1Test.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteRoleV1Test.java index 27652d30..ebd11753 100644 --- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteRoleV1Test.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/RemoteRoleV1Test.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -39,6 +39,7 @@ package org.onap.portalapp.portal.transport; //@RunWith(PowerMockRunner.class) import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -69,6 +70,36 @@ public class RemoteRoleV1Test { assertEquals(NAME, remoteRoleV1.getName()); } + @Test + public void testRemoteRole() { + RemoteRoleV1 remoteRoleV1=buildRemoteRoleV1(); + RemoteRoleV1 remoteRole=new RemoteRoleV1(); + RemoteRoleV1 remoteRoleV2=remoteRoleV1; + remoteRole.setId(ID); + remoteRole.setName(NAME); + + assertEquals(remoteRole.hashCode(), remoteRoleV1.hashCode()); + remoteRole.compareTo(remoteRoleV1); + assertTrue(remoteRole.equals(remoteRoleV1)); + assertFalse(remoteRole.equals(null)); + remoteRole.setName(null); + assertFalse(remoteRole.equals(remoteRoleV1)); + remoteRole.setId(null); + assertFalse(remoteRole.equals(remoteRoleV1)); + assertTrue(remoteRoleV2.equals(remoteRoleV1)); + + } + + private RemoteRoleV1 buildRemoteRoleV1() { + + RemoteRoleV1 remoteRole=new RemoteRoleV1(); + remoteRole.setId(ID); + remoteRole.setName(NAME); + return remoteRole; + } + + + @Test public void remoteRoleV1Test(){