2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * =============================================================================
7 * Modifications Copyright (C) 2018-2019 IBM.
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file 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 * ============LICENSE_END=========================================================
24 package org.onap.appc.flow.controller.data;
26 import static org.junit.Assert.assertTrue;
27 import static org.junit.Assert.assertFalse;
28 import static org.junit.Assert.assertEquals;
29 import org.junit.Test;
31 public class ActionIdentifierTest {
34 public void testHashCode() {
35 ActionIdentifier actionId1 = new ActionIdentifier();
36 ActionIdentifier actionId2 = new ActionIdentifier();
37 assertTrue(actionId1.hashCode() == actionId2.hashCode());
39 if (actionId1.equals(actionId2)) {
40 assertTrue(actionId1.hashCode() == actionId2.hashCode());
43 actionId2.setVnfcName("vnfcName");
44 assertFalse(actionId1.hashCode() == actionId2.hashCode());
46 actionId2.setVnfcName("");
47 assertTrue(actionId1.hashCode() == actionId2.hashCode());
49 actionId2.setVnfId("vnfId");
50 assertFalse(actionId1.hashCode() == actionId2.hashCode());
52 actionId2.setVnfId("");
53 assertTrue(actionId1.hashCode() == actionId2.hashCode());
55 actionId2.setVserverId("vserverId");
56 assertFalse(actionId1.hashCode() == actionId2.hashCode());
58 actionId2.setVserverId("");
59 assertTrue(actionId1.hashCode() == actionId2.hashCode());
63 public void testEquals() {
64 ActionIdentifier actionId1 = new ActionIdentifier();
65 ActionIdentifier actionId2 = new ActionIdentifier();
67 actionId1.setVnfcName("vnfcName");
68 actionId1.setVnfId("vnfId");
69 actionId1.setVserverId("vserverId");
70 actionId2.setVnfcName("vnfcName");
71 actionId2.setVnfId("vnfId");
72 actionId2.setVserverId("vserverId");
73 assertEquals(actionId1,actionId2);
74 assertEquals(actionId2,actionId1);
78 public void testSettersAndGetters() {
79 ActionIdentifier actionId = new ActionIdentifier();
80 actionId.setVserverId("vserverId");
81 assertEquals("vserverId", actionId.getVserverId());
83 actionId.setVnfcName("vnfcName");
84 assertEquals("vnfcName", actionId.getVnfcName());
86 actionId.setVnfId("vnfId");
87 assertEquals("vnfId", actionId.getVnfId());
91 public void testtoString() {
92 ActionIdentifier actionId = new ActionIdentifier();
93 actionId.setVnfcName("vnfcName");
94 String ret = actionId.toString();
95 assertFalse("toString is not empty", ret.isEmpty());