Add junit coverage for three classes 15/39815/2
authorNeha Sood <ns189k@att.com>
Wed, 28 Mar 2018 19:36:02 +0000 (15:36 -0400)
committerNeha Sood <ns189k@att.com>
Wed, 28 Mar 2018 20:05:59 +0000 (16:05 -0400)
Issue-ID: APPC-806

Change-Id: I5dc4da5fcd2325c6915b86a7f1c26d3a0f69cf9b
Signed-off-by: Neha Sood <ns189k@att.com>
appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/ParametersTest.java [new file with mode: 0644]
appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java [new file with mode: 0644]
appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PrecheckOptionTest.java [new file with mode: 0644]

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 (file)
index 0000000..729efd8
--- /dev/null
@@ -0,0 +1,79 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP : APPC\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.appc.flow.controller.data;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class ParametersTest {\r
+    private Parameters param;\r
+    private Parameters param1;\r
+    private Parameters param2;\r
+\r
+    @Before\r
+    public void SetUp() {\r
+        param = new Parameters();\r
+        param1 = new Parameters();\r
+        param2 = new Parameters();\r
+    }\r
+\r
+    @Test\r
+    public void testSetParamValue() {\r
+        param.setParamValue("1");\r
+        assertNotNull(param.getParamValue());\r
+        assertEquals(param.getParamValue(),"1");\r
+    }\r
+\r
+    @Test\r
+    public void testSetParamName() {\r
+        param.setParamName("abc");\r
+        assertNotNull(param.getParamName());\r
+        assertEquals(param.getParamName(),"abc");\r
+    }\r
+\r
+    @Test\r
+    public void testHashCode_Print() {\r
+        param.setParamName("2");\r
+        param.setParamValue("def");\r
+        System.out.println("param hashcode is " + param.hashCode());\r
+    }\r
+\r
+    @Test\r
+    public void testToString() {\r
+        param.setParamName("3");\r
+        param.setParamValue("ghi");\r
+        String ret = param.toString();\r
+        assertFalse("toString is not empty", ret.isEmpty());\r
+    }\r
+\r
+    @Test\r
+    public void testEqualsObject() {\r
+        assertTrue(param1.equals(param2) && param2.equals(param1));\r
+        assertTrue(param1.equals(param1));\r
+        assertFalse(param1.equals(null));\r
+    }\r
+}\r
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 (file)
index 0000000..2865c18
--- /dev/null
@@ -0,0 +1,72 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP : APPC\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+package org.onap.appc.flow.controller.data;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+\r
+import java.util.LinkedList;\r
+import java.util.List;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class PreCheckTest {\r
+    \r
+    private PreCheck preCheck;\r
+\r
+    @Before\r
+    public void SetUp() {\r
+        preCheck = new PreCheck();\r
+    }\r
+\r
+    @Test\r
+    public void testSetPrecheckOperator() {\r
+        preCheck.setPrecheckOperator("op");\r
+        assertNotNull(preCheck.getPrecheckOperator());\r
+        assertEquals(preCheck.getPrecheckOperator(),"op");\r
+    }\r
+\r
+    @Test\r
+    public void testSetPrecheckOptions() {\r
+        List<PrecheckOption> precheckOptionList = new LinkedList<>();\r
+        preCheck.setPrecheckOptions(precheckOptionList);\r
+        assertNotNull(preCheck.getPrecheckOptions());\r
+        assertEquals(preCheck.getPrecheckOptions(), precheckOptionList);\r
+    }\r
+\r
+    @Test\r
+    public void testHashCode() {\r
+        preCheck.setPrecheckOperator("1");\r
+        System.out.println(" precheck hashcode is "  + preCheck.hashCode());\r
+    }\r
+\r
+    @Test\r
+    public void testToString() {\r
+        preCheck.setPrecheckOperator("A");\r
+        List<PrecheckOption> precheckOptionList = new LinkedList<>();\r
+        preCheck.setPrecheckOptions(precheckOptionList);\r
+        String ret = preCheck.toString();\r
+        System.out.println("ret is " + ret);\r
+\r
+    }\r
+\r
+}\r
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 (file)
index 0000000..6fc51e4
--- /dev/null
@@ -0,0 +1,99 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP : APPC\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.appc.flow.controller.data;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class PrecheckOptionTest {\r
+    \r
+    private PrecheckOption precheckoption;\r
+    private PrecheckOption precheckoption1;\r
+    private PrecheckOption precheckoption2;\r
+\r
+    @Before\r
+    public void SetUp() {\r
+        precheckoption = new PrecheckOption();\r
+        precheckoption1 = new PrecheckOption();\r
+        precheckoption2 = new PrecheckOption();\r
+    }\r
+\r
+    @Test\r
+    public void testSetpTransactionID() {\r
+        precheckoption.setpTransactionID(1);\r
+        assertNotNull(precheckoption.getpTransactionID());\r
+        assertEquals(precheckoption.getpTransactionID(),1);\r
+    }\r
+\r
+    @Test\r
+    public void testSetParamName() {\r
+        precheckoption.setParamName("abc");\r
+        assertNotNull(precheckoption.getParamName());\r
+        assertEquals(precheckoption.getParamName(),"abc");\r
+    }\r
+\r
+    @Test\r
+    public void testSetParamValue() {\r
+        precheckoption.setParamValue("def");\r
+        assertNotNull(precheckoption.getParamValue());\r
+        assertEquals(precheckoption.getParamValue(),"def");\r
+    }\r
+\r
+    @Test\r
+    public void testToString() {\r
+        precheckoption.setParamName("abc");\r
+        precheckoption.setParamValue("ghi");\r
+        precheckoption.setpTransactionID(1);\r
+        precheckoption.setRule("jkl");\r
+        String ret = precheckoption.toString();\r
+        assertFalse("toString is not empty", ret.isEmpty());\r
+    }\r
+\r
+    @Test\r
+    public void testSetRule() {\r
+        precheckoption.setRule("abc");\r
+        assertNotNull(precheckoption.getRule());\r
+        assertEquals(precheckoption.getRule(),"abc");\r
+    }\r
+\r
+    @Test\r
+    public void testHashCode_Print() {\r
+        precheckoption.setpTransactionID(2);\r
+        precheckoption.setParamName("abc");\r
+        precheckoption.setParamValue("def");\r
+        precheckoption.setRule("jkl");\r
+        System.out.println("precheckoption hashcode is " + precheckoption.hashCode());\r
+    }\r
+\r
+    @Test\r
+    public void testEqualsObject() {\r
+        assertTrue(precheckoption1.equals(precheckoption2) && precheckoption2.equals(precheckoption1));\r
+        assertTrue(precheckoption1.equals(precheckoption1));\r
+        assertFalse(precheckoption1.equals(null));\r
+    }\r
+}\r