Improved the UT coverage
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / api / entity / AlarmsCorrelationTest.java
1 /**
2  * Copyright 2017 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.holmes.common.api.entity;
18
19 import static org.hamcrest.core.IsEqual.equalTo;
20 import static org.junit.Assert.assertThat;
21
22 import java.util.Date;
23 import org.junit.Test;
24 import org.junit.Before;
25 import org.junit.After;
26
27 public class AlarmsCorrelationTest {
28
29     private AlarmsCorrelation alarmsCorrelation;
30
31     @Before
32     public void before() throws Exception {
33         alarmsCorrelation = new AlarmsCorrelation();
34     }
35
36     @After
37     public void after() throws Exception {
38
39     }
40
41
42     @Test
43     public void getterAndSetter4RuleId() throws Exception {
44         final String ruleId = "ruleId";
45         alarmsCorrelation.setRuleId(ruleId);
46         assertThat(alarmsCorrelation.getRuleId(), equalTo(ruleId));
47     }
48
49
50     @Test
51     public void getterAndSetter4RuleInfo() throws Exception {
52         final String ruleInfo = "ruleInfo";
53         alarmsCorrelation.setRuleInfo(ruleInfo);
54         assertThat(alarmsCorrelation.getRuleInfo(), equalTo(ruleInfo));
55     }
56
57
58     @Test
59     public void getterAndSetter4ResultType() throws Exception {
60         final byte resultType = 1;
61         alarmsCorrelation.setResultType(resultType);
62         assertThat(alarmsCorrelation.getResultType(), equalTo(resultType));
63     }
64
65
66     @Test
67     public void getterAndSetter4CreateTime() throws Exception {
68         final Date createTime = new Date();
69         alarmsCorrelation.setCreateTime(createTime);
70         assertThat(alarmsCorrelation.getCreateTime(), equalTo(createTime));
71     }
72
73
74     @Test
75     public void getterAndSetter4ParentAlarmId() throws Exception {
76         final long pad = 11L;
77         alarmsCorrelation.setParentAlarmId(pad);
78         assertThat(alarmsCorrelation.getParentAlarmId(), equalTo(pad));
79     }
80
81
82     @Test
83     public void getterAndSetter4ChildAlarmId() throws Exception {
84         final long childAlarmId = 11L;
85         alarmsCorrelation.setChildAlarmId(childAlarmId);
86         assertThat(alarmsCorrelation.getChildAlarmId(), equalTo(childAlarmId));
87     }
88
89
90     @Test
91     public void getterAndSetter4Reserve1() throws Exception {
92         final long reserve1 = 11L;
93         alarmsCorrelation.setReserve1(reserve1);
94         assertThat(alarmsCorrelation.getReserve1(), equalTo(reserve1));
95     }
96
97
98     @Test
99     public void getterAndSetter4Reserve2() throws Exception {
100         final long reserve2 = 11L;
101         alarmsCorrelation.setReserve2(reserve2);
102         assertThat(alarmsCorrelation.getReserve2(), equalTo(reserve2));
103     }
104
105
106     @Test
107     public void getterAndSetter4Reserve3() throws Exception {
108         final long reserve3 = 11L;
109         alarmsCorrelation.setReserve3(reserve3);
110         assertThat(alarmsCorrelation.getReserve3(), equalTo(reserve3));
111     }
112
113     @Test
114     public void testToString() throws Exception {
115         final AlarmsCorrelation alarmsCorrelationTemp = new AlarmsCorrelation();
116         String ruleId = "ruleId";
117         alarmsCorrelationTemp.setRuleId(ruleId);
118         alarmsCorrelation.setRuleId(ruleId);
119         assertThat(alarmsCorrelation.toString(), equalTo(alarmsCorrelationTemp.toString()));
120     }
121 }