modify unique bug
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / api / stat / VesAlarmTest.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.stat;
18
19 import static org.hamcrest.core.IsEqual.equalTo;
20 import static org.junit.Assert.*;
21
22 import java.util.ArrayList;
23 import org.junit.Test;
24
25 public class VesAlarmTest {
26
27     @Test
28     public void hashCodeTest() throws Exception {
29         VesAlarm alarm = new VesAlarm();
30         alarm.setEventName("unique");
31         alarm.setSourceId("123");
32         VesAlarm alarmClone = (VesAlarm)alarm.clone();
33         assertTrue(alarm.hashCode() == alarmClone.hashCode());
34     }
35
36     @Test
37     public void equalsTest() throws Exception {
38         VesAlarm alarm = new VesAlarm();
39         alarm.setEventName("unique");
40         alarm.setSourceId("123");
41         VesAlarm alarmClone = (VesAlarm)alarm.clone();
42         assertTrue(alarm.equals(alarmClone));
43     }
44
45     @Test
46     public void cloneTest() throws Exception {
47         VesAlarm alarm = new VesAlarm();
48         alarm.setDomain("Test");
49         alarm.setEventName("unique");
50         alarm.setSourceId("123");
51         assertThat(alarm, equalTo(alarm.clone()));
52     }
53
54     @Test
55     public void getterAndSetterTest() {
56         VesAlarm alarm = new VesAlarm();
57         alarm.setDomain("");
58         alarm.setEventId("");
59         alarm.setEventName("");
60         alarm.setEventType("");
61         alarm.setInternalHeaderFields(new Object());
62         alarm.setLastEpochMicrosec(0L);
63         alarm.setNfcNamingCode("");
64         alarm.setNfNamingCode("");
65         alarm.setPriority("");
66         alarm.setReportingEntityId("");
67         alarm.setReportingEntityName("");
68         alarm.setSequence(1);
69         alarm.setSourceId("");
70         alarm.setSourceName("");
71         alarm.setStartEpochMicrosec(0L);
72         alarm.setVersion(0L);
73         alarm.setAlarmAdditionalInformation(new ArrayList<>());
74         alarm.setAlarmCondition("");
75         alarm.setAlarmInterfaceA("");
76         alarm.setEventCategory("");
77         alarm.setEventSeverity("");
78         alarm.setEventSourceType("");
79         alarm.setFaultFieldsVersion(0L);
80         alarm.setSpecificProblem("");
81         alarm.setVfStatus("");
82
83         alarm.getDomain();
84         alarm.getEventId();
85         alarm.getEventName();
86         alarm.getEventType();
87         alarm.getInternalHeaderFields();
88         alarm.getLastEpochMicrosec();
89         alarm.getNfcNamingCode();
90         alarm.getNfNamingCode();
91         alarm.getPriority();
92         alarm.getReportingEntityId();
93         alarm.getReportingEntityName();
94         alarm.getSequence();
95         alarm.getSourceId();
96         alarm.getSourceName();
97         alarm.getStartEpochMicrosec();
98         alarm.getVersion();
99         alarm.getAlarmAdditionalInformation();
100         alarm.getAlarmCondition();
101         alarm.getAlarmInterfaceA();
102         alarm.getEventCategory();
103         alarm.getEventSeverity();
104         alarm.getEventSourceType();
105         alarm.getFaultFieldsVersion();
106         alarm.getSpecificProblem();
107         alarm.getVfStatus();
108     }
109
110 }