+/*-\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