blob: 199ed0d94d07fc87a5135c5876f4fd1635b0bd5a [file] [log] [blame]
kmcpeake4fe18c82015-11-17 20:07:39 +00001/*
2 * Copyright 2014 Open Networking Laboratory
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 */
16package org.onosproject.incubator.net.faultmanagement.alarm;
17
18import static org.hamcrest.MatcherAssert.assertThat;
19import static org.hamcrest.Matchers.is;
20import static org.hamcrest.Matchers.notNullValue;
21import org.junit.Test;
22import static org.junit.Assert.*;
23import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
24import org.onosproject.net.DeviceId;
25
26public class DefaultAlarmTest {
27
28 @Test
29 public void testImmutability() {
30 assertThatClassIsImmutable(DefaultAlarm.class);
31 }
32
33 /**
34 * Checks the construction of a DefaultAlarm object.
35 */
36 @Test
37 public void testConstruction() {
38 final String nameValue = "name3";
39 final DefaultAlarm a = new DefaultAlarm.Builder(AlarmId.valueOf(4),
40 DeviceId.NONE, nameValue, Alarm.SeverityLevel.CLEARED, 3).build();
41
42 assertThat(a, is(notNullValue()));
43 final DefaultAlarm b = new DefaultAlarm.Builder(a).build();
44
45 assertEquals(a, b);
46 }
47}