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.onap.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;
27 public class AlarmsCorrelationTest {
29 private AlarmsCorrelation alarmsCorrelation;
32 public void before() throws Exception {
33 alarmsCorrelation = new AlarmsCorrelation();
37 public void after() throws Exception {
43 public void getterAndSetter4RuleId() throws Exception {
44 final String ruleId = "ruleId";
45 alarmsCorrelation.setRuleId(ruleId);
46 assertThat(alarmsCorrelation.getRuleId(), equalTo(ruleId));
51 public void getterAndSetter4RuleInfo() throws Exception {
52 final String ruleInfo = "ruleInfo";
53 alarmsCorrelation.setRuleInfo(ruleInfo);
54 assertThat(alarmsCorrelation.getRuleInfo(), equalTo(ruleInfo));
59 public void getterAndSetter4ResultType() throws Exception {
60 final byte resultType = 1;
61 alarmsCorrelation.setResultType(resultType);
62 assertThat(alarmsCorrelation.getResultType(), equalTo(resultType));
67 public void getterAndSetter4CreateTime() throws Exception {
68 final Date createTime = new Date();
69 alarmsCorrelation.setCreateTime(createTime);
70 assertThat(alarmsCorrelation.getCreateTime(), equalTo(createTime));
75 public void getterAndSetter4ParentAlarmId() throws Exception {
77 alarmsCorrelation.setParentAlarmId(pad);
78 assertThat(alarmsCorrelation.getParentAlarmId(), equalTo(pad));
83 public void getterAndSetter4ChildAlarmId() throws Exception {
84 final long childAlarmId = 11L;
85 alarmsCorrelation.setChildAlarmId(childAlarmId);
86 assertThat(alarmsCorrelation.getChildAlarmId(), equalTo(childAlarmId));
91 public void getterAndSetter4Reserve1() throws Exception {
92 final long reserve1 = 11L;
93 alarmsCorrelation.setReserve1(reserve1);
94 assertThat(alarmsCorrelation.getReserve1(), equalTo(reserve1));
99 public void getterAndSetter4Reserve2() throws Exception {
100 final long reserve2 = 11L;
101 alarmsCorrelation.setReserve2(reserve2);
102 assertThat(alarmsCorrelation.getReserve2(), equalTo(reserve2));
107 public void getterAndSetter4Reserve3() throws Exception {
108 final long reserve3 = 11L;
109 alarmsCorrelation.setReserve3(reserve3);
110 assertThat(alarmsCorrelation.getReserve3(), equalTo(reserve3));
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()));