kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame^] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.incubator.net.faultmanagement.alarm; |
| 17 | |
| 18 | import static org.hamcrest.MatcherAssert.assertThat; |
| 19 | import static org.hamcrest.Matchers.is; |
| 20 | import static org.hamcrest.Matchers.notNullValue; |
| 21 | import org.junit.Test; |
| 22 | import static org.junit.Assert.*; |
| 23 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 24 | import org.onosproject.net.DeviceId; |
| 25 | |
| 26 | public 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 | } |