2 * ============LICENSE_START=======================================================
\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
13 * http://www.apache.org/licenses/LICENSE-2.0
\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
21 * ============LICENSE_END=========================================================
\r
24 package org.onap.appc.flow.controller.data;
\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
31 import org.junit.Before;
\r
32 import org.junit.Test;
\r
34 public class ParametersTest {
\r
35 private Parameters param;
\r
36 private Parameters param1;
\r
37 private Parameters param2;
\r
40 public void SetUp() {
\r
41 param = new Parameters();
\r
42 param1 = new Parameters();
\r
43 param2 = new Parameters();
\r
47 public void testSetParamValue() {
\r
48 param.setParamValue("1");
\r
49 assertNotNull(param.getParamValue());
\r
50 assertEquals(param.getParamValue(),"1");
\r
54 public void testSetParamName() {
\r
55 param.setParamName("abc");
\r
56 assertNotNull(param.getParamName());
\r
57 assertEquals(param.getParamName(),"abc");
\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
68 public void testToString() {
\r
69 param.setParamName("3");
\r
70 param.setParamValue("ghi");
\r
71 String ret = param.toString();
\r
72 assertFalse("toString is not empty", ret.isEmpty());
\r
76 public void testEqualsObject() {
\r
77 assertTrue(param1.equals(param2) && param2.equals(param1));
\r
78 assertFalse(param1.equals(null));
\r
79 assertFalse(param1.equals(""));
\r
80 param2.setParamName("other_param_name");
\r
81 assertFalse(param1.equals(param2));
\r
82 param1.setParamName("param_name");
\r
83 assertFalse(param1.equals(param2));
\r
84 param2.setParamName("param_name");
\r
85 param2.setParamValue("other_param_value");
\r
86 assertFalse(param1.equals(param2));
\r
87 param1.setParamValue("param_value");
\r
88 assertFalse(param1.equals(param2));
\r
89 param2.setParamValue("param_value");
\r
90 assertTrue(param1.equals(param1));
\r