added test case to PreCheckTest.java
[appc.git] / appc-config / appc-flow-controller / provider / src / test / java / org / onap / appc / flow / controller / data / PreCheckTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
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
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  * ============LICENSE_END=========================================================
22  */
23 package org.onap.appc.flow.controller.data;
24
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;
29
30 import java.util.LinkedList;
31 import java.util.List;
32
33 import org.junit.Before;
34 import org.junit.Test;
35
36 public class PreCheckTest {
37     
38     private PreCheck preCheck;
39     private PreCheck preCheck1;
40     private PreCheck preCheck2;
41
42     @Before
43     public void SetUp() {
44         preCheck = new PreCheck();
45         preCheck1 = new PreCheck();
46         preCheck2 = new PreCheck();
47     }
48
49     @Test
50     public void testSetPrecheckOperator() {
51         preCheck.setPrecheckOperator("op");
52         assertNotNull(preCheck.getPrecheckOperator());
53         assertEquals(preCheck.getPrecheckOperator(),"op");
54     }
55
56     @Test
57     public void testSetPrecheckOptions() {
58         List<PrecheckOption> precheckOptionList = new LinkedList<>();
59         preCheck.setPrecheckOptions(precheckOptionList);
60         assertNotNull(preCheck.getPrecheckOptions());
61         assertEquals(preCheck.getPrecheckOptions(), precheckOptionList);
62     }
63
64     @Test
65     public void testHashCode() {
66         preCheck.setPrecheckOperator("1");
67         System.out.println(" precheck hashcode is "  + preCheck.hashCode());
68     }
69
70     @Test
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);
77
78     }
79     
80     @Test
81     public void testEqualsObject() {
82         assertTrue(preCheck1.equals(preCheck2) && preCheck2.equals(preCheck1));
83         assertTrue(preCheck1.equals(preCheck1));
84         assertFalse(preCheck1.equals(null));
85     }
86
87 }