2 * Copyright 2017 ZTE Corporation.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.openo.holmes.common.api.entity;
19 import static org.hamcrest.core.IsEqual.equalTo;
20 import static org.junit.Assert.assertThat;
22 import java.util.Date;
23 import org.junit.Test;
24 import org.junit.Before;
25 import org.junit.After;
26 import sun.util.resources.cldr.ga.LocaleNames_ga;
28 public class AlarmsCorrelationTest {
30 private AlarmsCorrelation alarmsCorrelation;
33 public void before() throws Exception {
34 alarmsCorrelation = new AlarmsCorrelation();
38 public void after() throws Exception {
44 public void getterAndSetter4RuleId() throws Exception {
45 final String ruleId = "ruleId";
46 alarmsCorrelation.setRuleId(ruleId);
47 assertThat(alarmsCorrelation.getRuleId(), equalTo(ruleId));
52 public void getterAndSetter4RuleInfo() throws Exception {
53 final String ruleInfo = "ruleInfo";
54 alarmsCorrelation.setRuleInfo(ruleInfo);
55 assertThat(alarmsCorrelation.getRuleInfo(), equalTo(ruleInfo));
60 public void getterAndSetter4ResultType() throws Exception {
61 final byte resultType = 1;
62 alarmsCorrelation.setResultType(resultType);
63 assertThat(alarmsCorrelation.getResultType(), equalTo(resultType));
68 public void getterAndSetter4CreateTime() throws Exception {
69 final Date createTime = new Date();
70 alarmsCorrelation.setCreateTime(createTime);
71 assertThat(alarmsCorrelation.getCreateTime(), equalTo(createTime));
76 public void getterAndSetter4ParentAlarmId() throws Exception {
78 alarmsCorrelation.setParentAlarmId(pad);
79 assertThat(alarmsCorrelation.getParentAlarmId(), equalTo(pad));
84 public void getterAndSetter4ChildAlarmId() throws Exception {
85 final long childAlarmId = 11L;
86 alarmsCorrelation.setChildAlarmId(childAlarmId);
87 assertThat(alarmsCorrelation.getChildAlarmId(), equalTo(childAlarmId));
92 public void getterAndSetter4Reserve1() throws Exception {
93 final long reserve1 = 11L;
94 alarmsCorrelation.setReserve1(reserve1);
95 assertThat(alarmsCorrelation.getReserve1(), equalTo(reserve1));
100 public void getterAndSetter4Reserve2() throws Exception {
101 final long reserve2 = 11L;
102 alarmsCorrelation.setReserve2(reserve2);
103 assertThat(alarmsCorrelation.getReserve2(), equalTo(reserve2));
108 public void getterAndSetter4Reserve3() throws Exception {
109 final long reserve3 = 11L;
110 alarmsCorrelation.setReserve3(reserve3);
111 assertThat(alarmsCorrelation.getReserve3(), equalTo(reserve3));
116 public void testToString() throws Exception {
117 final AlarmsCorrelation alarmsCorrelationTemp = new AlarmsCorrelation();
118 String ruleId = "ruleId";
119 alarmsCorrelationTemp.setRuleId(ruleId);
120 alarmsCorrelation.setRuleId(ruleId);
121 assertThat(alarmsCorrelation.toString(), equalTo(alarmsCorrelationTemp.toString()));
126 public void testEqualsAndHashCode() throws Exception {
127 final AlarmsCorrelation alarmsCorrelationTemp = new AlarmsCorrelation();
128 String ruleId = "ruleId";
129 alarmsCorrelationTemp.setRuleId(ruleId);
130 alarmsCorrelation.setRuleId(ruleId);
131 assertThat(alarmsCorrelation, equalTo(alarmsCorrelationTemp));