added asserts statements in 5 JUnits
[appc.git] / appc-config / appc-flow-controller / provider / src / test / java / org / onap / appc / flow / controller / data / ParametersTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP : APPC\r
4  * ================================================================================\r
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Modifications Copyright (C) 2019 Ericsson\r
8  * =============================================================================\r
9  * Licensed under the Apache License, Version 2.0 (the "License");\r
10  * you may not use this file except in compliance with the License.\r
11  * You may obtain a copy of the License at\r
12  *\r
13  *      http://www.apache.org/licenses/LICENSE-2.0\r
14  *\r
15  * Unless required by applicable law or agreed to in writing, software\r
16  * distributed under the License is distributed on an "AS IS" BASIS,\r
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
18  * See the License for the specific language governing permissions and\r
19  * limitations under the License.\r
20  *\r
21  * ============LICENSE_END=========================================================\r
22  */\r
23 \r
24 package org.onap.appc.flow.controller.data;\r
25 \r
26 import static org.junit.Assert.assertTrue;\r
27 import static org.junit.Assert.assertFalse;\r
28 import static org.junit.Assert.assertEquals;\r
29 import static org.junit.Assert.assertNotNull;\r
30 \r
31 import org.junit.Before;\r
32 import org.junit.Test;\r
33 \r
34 public class ParametersTest {\r
35     private Parameters param;\r
36     private Parameters param1;\r
37     private Parameters param2;\r
38 \r
39     @Before\r
40     public void SetUp() {\r
41         param = new Parameters();\r
42         param1 = new Parameters();\r
43         param2 = new Parameters();\r
44     }\r
45 \r
46     @Test\r
47     public void testSetParamValue() {\r
48         param.setParamValue("1");\r
49         assertNotNull(param.getParamValue());\r
50         assertEquals(param.getParamValue(),"1");\r
51     }\r
52 \r
53     @Test\r
54     public void testSetParamName() {\r
55         param.setParamName("abc");\r
56         assertNotNull(param.getParamName());\r
57         assertEquals(param.getParamName(),"abc");\r
58     }\r
59 \r
60     @Test\r
61     public void testHashCode_Print() {\r
62         param.setParamName("2");\r
63         param.setParamValue("def");\r
64         System.out.println("param hashcode is " + param.hashCode());\r
65         assertNotNull(param);\r
66     }\r
67 \r
68     @Test\r
69     public void testToString() {\r
70         param.setParamName("3");\r
71         param.setParamValue("ghi");\r
72         String ret = param.toString();\r
73         assertFalse("toString is not empty", ret.isEmpty());\r
74     }\r
75 \r
76     @Test\r
77     public void testEqualsObject() {\r
78         assertTrue(param1.equals(param2) && param2.equals(param1));\r
79         assertFalse(param1.equals(null));\r
80         assertFalse(param1.equals(""));\r
81         param2.setParamName("other_param_name");\r
82         assertFalse(param1.equals(param2));\r
83         param1.setParamName("param_name");\r
84         assertFalse(param1.equals(param2));\r
85         param2.setParamName("param_name");\r
86         param2.setParamValue("other_param_value");\r
87         assertFalse(param1.equals(param2));\r
88         param1.setParamValue("param_value");\r
89         assertFalse(param1.equals(param2));\r
90         param2.setParamValue("param_value");\r
91         assertTrue(param1.equals(param1));\r
92     }\r
93 }\r