aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeha Sood <ns189k@att.com>2018-03-28 15:36:02 -0400
committerNeha Sood <ns189k@att.com>2018-03-28 16:05:59 -0400
commit0623e356a4194a573cbb1e763abae91c6edae656 (patch)
tree20c68e2fdc012de736b931be8748d4acfe255a18
parenta8d5c9c5793c65b65d77b00ab8ac7d4577ba8730 (diff)
Add junit coverage for three classes
Issue-ID: APPC-806 Change-Id: I5dc4da5fcd2325c6915b86a7f1c26d3a0f69cf9b Signed-off-by: Neha Sood <ns189k@att.com>
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ParametersTest.java79
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java72
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PrecheckOptionTest.java99
3 files changed, 250 insertions, 0 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ParametersTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ParametersTest.java
new file mode 100644
index 000000000..729efd8d3
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ParametersTest.java
@@ -0,0 +1,79 @@
+/*-
+ * ============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 static org.junit.Assert.assertNotNull;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ParametersTest {
+ private Parameters param;
+ private Parameters param1;
+ private Parameters param2;
+
+ @Before
+ public void SetUp() {
+ param = new Parameters();
+ param1 = new Parameters();
+ param2 = new Parameters();
+ }
+
+ @Test
+ public void testSetParamValue() {
+ param.setParamValue("1");
+ assertNotNull(param.getParamValue());
+ assertEquals(param.getParamValue(),"1");
+ }
+
+ @Test
+ public void testSetParamName() {
+ param.setParamName("abc");
+ assertNotNull(param.getParamName());
+ assertEquals(param.getParamName(),"abc");
+ }
+
+ @Test
+ public void testHashCode_Print() {
+ param.setParamName("2");
+ param.setParamValue("def");
+ System.out.println("param hashcode is " + param.hashCode());
+ }
+
+ @Test
+ public void testToString() {
+ param.setParamName("3");
+ param.setParamValue("ghi");
+ String ret = param.toString();
+ assertFalse("toString is not empty", ret.isEmpty());
+ }
+
+ @Test
+ public void testEqualsObject() {
+ assertTrue(param1.equals(param2) && param2.equals(param1));
+ assertTrue(param1.equals(param1));
+ assertFalse(param1.equals(null));
+ }
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java
new file mode 100644
index 000000000..2865c18e0
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java
@@ -0,0 +1,72 @@
+/*-
+ * ============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.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class PreCheckTest {
+
+ private PreCheck preCheck;
+
+ @Before
+ public void SetUp() {
+ preCheck = new PreCheck();
+ }
+
+ @Test
+ public void testSetPrecheckOperator() {
+ preCheck.setPrecheckOperator("op");
+ assertNotNull(preCheck.getPrecheckOperator());
+ assertEquals(preCheck.getPrecheckOperator(),"op");
+ }
+
+ @Test
+ public void testSetPrecheckOptions() {
+ List<PrecheckOption> precheckOptionList = new LinkedList<>();
+ preCheck.setPrecheckOptions(precheckOptionList);
+ assertNotNull(preCheck.getPrecheckOptions());
+ assertEquals(preCheck.getPrecheckOptions(), precheckOptionList);
+ }
+
+ @Test
+ public void testHashCode() {
+ preCheck.setPrecheckOperator("1");
+ System.out.println(" precheck hashcode is " + preCheck.hashCode());
+ }
+
+ @Test
+ public void testToString() {
+ preCheck.setPrecheckOperator("A");
+ List<PrecheckOption> precheckOptionList = new LinkedList<>();
+ preCheck.setPrecheckOptions(precheckOptionList);
+ String ret = preCheck.toString();
+ System.out.println("ret is " + ret);
+
+ }
+
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PrecheckOptionTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PrecheckOptionTest.java
new file mode 100644
index 000000000..6fc51e438
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PrecheckOptionTest.java
@@ -0,0 +1,99 @@
+/*-
+ * ============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 static org.junit.Assert.assertNotNull;
+
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class PrecheckOptionTest {
+
+ private PrecheckOption precheckoption;
+ private PrecheckOption precheckoption1;
+ private PrecheckOption precheckoption2;
+
+ @Before
+ public void SetUp() {
+ precheckoption = new PrecheckOption();
+ precheckoption1 = new PrecheckOption();
+ precheckoption2 = new PrecheckOption();
+ }
+
+ @Test
+ public void testSetpTransactionID() {
+ precheckoption.setpTransactionID(1);
+ assertNotNull(precheckoption.getpTransactionID());
+ assertEquals(precheckoption.getpTransactionID(),1);
+ }
+
+ @Test
+ public void testSetParamName() {
+ precheckoption.setParamName("abc");
+ assertNotNull(precheckoption.getParamName());
+ assertEquals(precheckoption.getParamName(),"abc");
+ }
+
+ @Test
+ public void testSetParamValue() {
+ precheckoption.setParamValue("def");
+ assertNotNull(precheckoption.getParamValue());
+ assertEquals(precheckoption.getParamValue(),"def");
+ }
+
+ @Test
+ public void testToString() {
+ precheckoption.setParamName("abc");
+ precheckoption.setParamValue("ghi");
+ precheckoption.setpTransactionID(1);
+ precheckoption.setRule("jkl");
+ String ret = precheckoption.toString();
+ assertFalse("toString is not empty", ret.isEmpty());
+ }
+
+ @Test
+ public void testSetRule() {
+ precheckoption.setRule("abc");
+ assertNotNull(precheckoption.getRule());
+ assertEquals(precheckoption.getRule(),"abc");
+ }
+
+ @Test
+ public void testHashCode_Print() {
+ precheckoption.setpTransactionID(2);
+ precheckoption.setParamName("abc");
+ precheckoption.setParamValue("def");
+ precheckoption.setRule("jkl");
+ System.out.println("precheckoption hashcode is " + precheckoption.hashCode());
+ }
+
+ @Test
+ public void testEqualsObject() {
+ assertTrue(precheckoption1.equals(precheckoption2) && precheckoption2.equals(precheckoption1));
+ assertTrue(precheckoption1.equals(precheckoption1));
+ assertFalse(precheckoption1.equals(null));
+ }
+}