2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
\r
6 * =============================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 * ============LICENSE_END=========================================================
\r
22 package org.onap.appc.flow.controller.data;
\r
24 import static org.junit.Assert.assertTrue;
\r
25 import static org.junit.Assert.assertFalse;
\r
26 import static org.junit.Assert.assertEquals;
\r
27 import org.junit.Test;
\r
29 public class ActionIdentifierTest {
\r
32 public void testHashCode() {
\r
33 ActionIdentifier actionId1 = new ActionIdentifier();
\r
34 ActionIdentifier actionId2 = new ActionIdentifier();
\r
35 assertTrue(actionId1.hashCode() == actionId2.hashCode());
\r
37 if (actionId1.equals(actionId2)) {
\r
38 assertTrue(actionId1.hashCode() == actionId2.hashCode());
\r
41 actionId2.setVnfcName("vnfcName");
\r
42 assertFalse(actionId1.hashCode() == actionId2.hashCode());
\r
44 actionId2.setVnfcName("");
\r
45 assertTrue(actionId1.hashCode() == actionId2.hashCode());
\r
47 actionId2.setVnfId("vnfId");
\r
48 assertFalse(actionId1.hashCode() == actionId2.hashCode());
\r
50 actionId2.setVnfId("");
\r
51 assertTrue(actionId1.hashCode() == actionId2.hashCode());
\r
53 actionId2.setVserverId("vserverId");
\r
54 assertFalse(actionId1.hashCode() == actionId2.hashCode());
\r
56 actionId2.setVserverId("");
\r
57 assertTrue(actionId1.hashCode() == actionId2.hashCode());
\r
61 public void testEquals() {
\r
62 ActionIdentifier actionId1 = new ActionIdentifier();
\r
63 ActionIdentifier actionId2 = new ActionIdentifier();
\r
65 assertTrue(actionId1.equals(actionId2) && actionId2.equals(actionId1));
\r
66 assertTrue(actionId1.equals(actionId1));
\r
67 assertFalse(actionId1.equals(null));
\r
71 public void testSettersAndGetters() {
\r
72 ActionIdentifier actionId = new ActionIdentifier();
\r
73 actionId.setVserverId("vserverId");
\r
74 assertEquals("vserverId", actionId.getVserverId());
\r
76 actionId.setVnfcName("vnfcName");
\r
77 assertEquals("vnfcName", actionId.getVnfcName());
\r
79 actionId.setVnfId("vnfId");
\r
80 assertEquals("vnfId", actionId.getVnfId());
\r
84 public void testtoString() {
\r
85 ActionIdentifier actionId = new ActionIdentifier();
\r
86 actionId.setVnfcName("vnfcName");
\r
87 String ret = actionId.toString();
\r
88 assertFalse("toString is not empty", ret.isEmpty());
\r