summaryrefslogtreecommitdiffstats
path: root/appc-config
diff options
context:
space:
mode:
authorNeha Sood <ns189k@att.com>2018-03-23 10:19:28 -0400
committerTakamune Cho <tc012c@att.com>2018-03-23 15:18:59 +0000
commit6afc0a5ab5cd73c6e1b0bc410dcf05666ec56f2c (patch)
tree91d6b0cf1c36817cd42f12fca3d020cf5b5ee925 /appc-config
parent2904df4757d124e72f9d26cda804faa8ab7cf9cd (diff)
Add Junit coverage for ActionIdentifier class
Introduce junit tests for ActionIdentifier class Change-Id: If14abe7b165d310d693d0d3ea04b563c0b68edd4 Issue-ID: APPC-777 Signed-off-by: Neha Sood <ns189k@att.com>
Diffstat (limited to 'appc-config')
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ActionIdentifierTest.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ActionIdentifierTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ActionIdentifierTest.java
new file mode 100644
index 000000000..220e791ba
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ActionIdentifierTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.flow.controller.data;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class ActionIdentifierTest {
+
+ @Test
+ public void testHashCode() {
+ ActionIdentifier actionId1 = new ActionIdentifier();
+ ActionIdentifier actionId2 = new ActionIdentifier();
+ assertTrue(actionId1.hashCode() == actionId2.hashCode());
+
+ if (actionId1.equals(actionId2)) {
+ assertTrue(actionId1.hashCode() == actionId2.hashCode());
+ }
+
+ actionId2.setVnfcName("vnfcName");
+ assertFalse(actionId1.hashCode() == actionId2.hashCode());
+
+ actionId2.setVnfcName("");
+ assertTrue(actionId1.hashCode() == actionId2.hashCode());
+
+ actionId2.setVnfId("vnfId");
+ assertFalse(actionId1.hashCode() == actionId2.hashCode());
+
+ actionId2.setVnfId("");
+ assertTrue(actionId1.hashCode() == actionId2.hashCode());
+
+ actionId2.setVserverId("vserverId");
+ assertFalse(actionId1.hashCode() == actionId2.hashCode());
+
+ actionId2.setVserverId("");
+ assertTrue(actionId1.hashCode() == actionId2.hashCode());
+ }
+
+ @Test
+ public void testEquals() {
+ ActionIdentifier actionId1 = new ActionIdentifier();
+ ActionIdentifier actionId2 = new ActionIdentifier();
+
+ assertTrue(actionId1.equals(actionId2) && actionId2.equals(actionId1));
+ assertTrue(actionId1.equals(actionId1));
+ assertFalse(actionId1.equals(null));
+ }
+
+ @Test
+ public void testSettersAndGetters() {
+ ActionIdentifier actionId = new ActionIdentifier();
+ actionId.setVserverId("vserverId");
+ assertEquals("vserverId", actionId.getVserverId());
+
+ actionId.setVnfcName("vnfcName");
+ assertEquals("vnfcName", actionId.getVnfcName());
+
+ actionId.setVnfId("vnfId");
+ assertEquals("vnfId", actionId.getVnfId());
+ }
+
+ @Test
+ public void testtoString() {
+ ActionIdentifier actionId = new ActionIdentifier();
+ actionId.setVnfcName("vnfcName");
+ String ret = actionId.toString();
+ assertFalse("toString is not empty", ret.isEmpty());
+ }
+
+}