2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.transport;
40 //@RunWith(PowerMockRunner.class)
41 import static org.junit.Assert.assertEquals;
42 import static org.junit.Assert.assertFalse;
43 import static org.junit.Assert.assertNotNull;
44 import static org.junit.Assert.assertTrue;
46 import org.junit.Before;
47 import org.junit.Test;
49 public class RemoteRoleV1Test {
50 RemoteRoleV1 remoteRoleV1;
51 private String NAME = "test";
52 private Long ID = 12L;
56 remoteRoleV1 = new RemoteRoleV1();
57 remoteRoleV1.setName(NAME);
58 remoteRoleV1.setId(ID);
63 public void testNotNull() {
64 assertNotNull(remoteRoleV1);
68 public void testRemoteRoleV1Properties() {
69 assertEquals(ID, remoteRoleV1.getId());
70 assertEquals(NAME, remoteRoleV1.getName());
74 public void testRemoteRole() {
75 RemoteRoleV1 remoteRoleV1=buildRemoteRoleV1();
76 RemoteRoleV1 remoteRole=new RemoteRoleV1();
77 RemoteRoleV1 remoteRoleV2=remoteRoleV1;
79 remoteRole.setName(NAME);
81 assertEquals(remoteRole.hashCode(), remoteRoleV1.hashCode());
82 remoteRole.compareTo(remoteRoleV1);
83 assertTrue(remoteRole.equals(remoteRoleV1));
84 assertFalse(remoteRole.equals(null));
85 remoteRole.setName(null);
86 assertFalse(remoteRole.equals(remoteRoleV1));
87 remoteRole.setId(null);
88 assertFalse(remoteRole.equals(remoteRoleV1));
89 assertTrue(remoteRoleV2.equals(remoteRoleV1));
93 private RemoteRoleV1 buildRemoteRoleV1() {
95 RemoteRoleV1 remoteRole=new RemoteRoleV1();
97 remoteRole.setName(NAME);
104 public void remoteRoleV1Test(){
106 RemoteRoleV1 remoteRoleV11 = new RemoteRoleV1();
107 RemoteRoleV1 remoteRoleV12 = new RemoteRoleV1();
108 RemoteRoleV1 remoteRoleV13 = new RemoteRoleV1();
109 remoteRoleV13.setId(12L);
110 remoteRoleV13.setName("test");
112 assertEquals(new Long(12), remoteRoleV1.getId());
113 assertEquals(remoteRoleV1.getName(), "test");
114 assertEquals(remoteRoleV1.hashCode(), remoteRoleV13.hashCode());
116 assertTrue(remoteRoleV11.equals(new RemoteRoleV1()));
117 assertTrue(remoteRoleV12.equals(new RemoteRoleV1()));
121 public void testcompareTo() {
122 assertEquals(0, remoteRoleV1.compareTo(remoteRoleV1));