blob: 7407821155ce20ecade5cfac3cc54679982c0506 [file] [log] [blame]
Naoki Shiota03c29e12016-05-16 16:58:07 -07001/*
2 * Copyright 2016 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
17package org.onosproject.newoptical.api;
18
19import org.junit.Test;
20import com.google.common.testing.EqualsTester;
21
22import static org.junit.Assert.assertEquals;
23import static org.junit.Assert.assertNotNull;
24import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
25
26/**
27 * Test class for OpticalConnectivityId.
28 */
29public class OpticalConnectivityIdTest {
30
31 /**
32 * Checks that OpticalConnectivityId class is immutable.
33 */
34 @Test
35 public void testImmutability() {
36 assertThatClassIsImmutable(OpticalConnectivityId.class);
37 }
38
39 /**
40 * Checks the construction of OpticalConnectivityId object.
41 */
42 @Test
43 public void testConstruction() {
44 OpticalConnectivityId tid = OpticalConnectivityId.of(1L);
45 assertNotNull(tid);
46 assertEquals(tid.id().longValue(), 1L);
47 }
48
49 /**
50 * Checks the equality of OpticalConnectivityId objects.
51 */
52 @Test
53 public void testEquality() {
54 OpticalConnectivityId tid1 = OpticalConnectivityId.of(1L);
55 OpticalConnectivityId tid2 = OpticalConnectivityId.of(1L);
56 OpticalConnectivityId tid3 = OpticalConnectivityId.of(2L);
57
58 new EqualsTester()
59 .addEqualityGroup(tid1, tid2)
60 .addEqualityGroup(tid3)
61 .testEquals();
62 }
63}