2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
\r
6 * =============================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 * ============LICENSE_END=========================================================
\r
22 package org.onap.appc.flow.controller.data;
\r
24 import static org.junit.Assert.assertTrue;
\r
25 import static org.junit.Assert.assertFalse;
\r
26 import static org.junit.Assert.assertEquals;
\r
27 import static org.junit.Assert.assertNotNull;
\r
30 import org.junit.Before;
\r
31 import org.junit.Test;
\r
33 public class PrecheckOptionTest {
\r
35 private PrecheckOption precheckoption;
\r
36 private PrecheckOption precheckoption1;
\r
37 private PrecheckOption precheckoption2;
\r
40 public void SetUp() {
\r
41 precheckoption = new PrecheckOption();
\r
42 precheckoption1 = new PrecheckOption();
\r
43 precheckoption2 = new PrecheckOption();
\r
47 public void testSetpTransactionID() {
\r
48 precheckoption.setpTransactionID(1);
\r
49 assertNotNull(precheckoption.getpTransactionID());
\r
50 assertEquals(precheckoption.getpTransactionID(),1);
\r
54 public void testSetParamName() {
\r
55 precheckoption.setParamName("abc");
\r
56 assertNotNull(precheckoption.getParamName());
\r
57 assertEquals(precheckoption.getParamName(),"abc");
\r
61 public void testSetParamValue() {
\r
62 precheckoption.setParamValue("def");
\r
63 assertNotNull(precheckoption.getParamValue());
\r
64 assertEquals(precheckoption.getParamValue(),"def");
\r
68 public void testToString() {
\r
69 precheckoption.setParamName("abc");
\r
70 precheckoption.setParamValue("ghi");
\r
71 precheckoption.setpTransactionID(1);
\r
72 precheckoption.setRule("jkl");
\r
73 String ret = precheckoption.toString();
\r
74 assertFalse("toString is not empty", ret.isEmpty());
\r
78 public void testSetRule() {
\r
79 precheckoption.setRule("abc");
\r
80 assertNotNull(precheckoption.getRule());
\r
81 assertEquals(precheckoption.getRule(),"abc");
\r
85 public void testHashCode_Print() {
\r
86 precheckoption.setpTransactionID(2);
\r
87 precheckoption.setParamName("abc");
\r
88 precheckoption.setParamValue("def");
\r
89 precheckoption.setRule("jkl");
\r
90 System.out.println("precheckoption hashcode is " + precheckoption.hashCode());
\r
94 public void testEqualsObject() {
\r
95 assertTrue(precheckoption1.equals(precheckoption2) && precheckoption2.equals(precheckoption1));
\r
96 assertTrue(precheckoption1.equals(precheckoption1));
\r
97 assertFalse(precheckoption1.equals(null));
\r