2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * =============================================================================
7 * Modifications Copyright (C) 2018 IBM.
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ============LICENSE_END=========================================================
23 package org.onap.appc.flow.controller.data;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertFalse;
27 import static org.junit.Assert.assertNotNull;
28 import static org.junit.Assert.assertTrue;
30 import java.util.LinkedList;
31 import java.util.List;
33 import org.junit.Before;
34 import org.junit.Test;
36 public class PreCheckTest {
38 private PreCheck preCheck;
39 private PreCheck preCheck1;
40 private PreCheck preCheck2;
44 preCheck = new PreCheck();
45 preCheck1 = new PreCheck();
46 preCheck2 = new PreCheck();
50 public void testSetPrecheckOperator() {
51 preCheck.setPrecheckOperator("op");
52 assertNotNull(preCheck.getPrecheckOperator());
53 assertEquals(preCheck.getPrecheckOperator(),"op");
57 public void testSetPrecheckOptions() {
58 List<PrecheckOption> precheckOptionList = new LinkedList<>();
59 preCheck.setPrecheckOptions(precheckOptionList);
60 assertNotNull(preCheck.getPrecheckOptions());
61 assertEquals(preCheck.getPrecheckOptions(), precheckOptionList);
65 public void testHashCode() {
66 preCheck.setPrecheckOperator("1");
67 System.out.println(" precheck hashcode is " + preCheck.hashCode());
71 public void testToString() {
72 preCheck.setPrecheckOperator("A");
73 List<PrecheckOption> precheckOptionList = new LinkedList<>();
74 preCheck.setPrecheckOptions(precheckOptionList);
75 String ret = preCheck.toString();
76 System.out.println("ret is " + ret);
81 public void testEqualsObject() {
82 assertTrue(preCheck1.equals(preCheck2) && preCheck2.equals(preCheck1));
83 assertTrue(preCheck1.equals(preCheck1));
84 assertFalse(preCheck1.equals(null));