added test case to PreCheckTest.java 23/57323/3
authorSandeep J <sandeejh@in.ibm.com>
Tue, 24 Jul 2018 12:31:51 +0000 (18:01 +0530)
committerPatrick Brady <pb071s@att.com>
Tue, 24 Jul 2018 20:03:01 +0000 (20:03 +0000)
added test case to increase code coverage

Issue-ID: APPC-1086
Change-Id: I51aff34afc47db330c773431d59a5e30cea74d79
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java

index 2865c18..80e0384 100644 (file)
@@ -1,72 +1,87 @@
-/*-\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
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * =============================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * =============================================================================
+ * 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.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class PreCheckTest {
+    
+    private PreCheck preCheck;
+    private PreCheck preCheck1;
+    private PreCheck preCheck2;
+
+    @Before
+    public void SetUp() {
+        preCheck = new PreCheck();
+        preCheck1 = new PreCheck();
+        preCheck2 = 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);
+
+    }
+    
+    @Test
+    public void testEqualsObject() {
+        assertTrue(preCheck1.equals(preCheck2) && preCheck2.equals(preCheck1));
+        assertTrue(preCheck1.equals(preCheck1));
+        assertFalse(preCheck1.equals(null));
+    }
+
+}