blob: e5fe5055ddf5a8e03d674c12c8cc694bb35176a6 [file] [log] [blame]
Mahesh Poojary Huawei1cb37fe2015-11-04 11:33:54 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Mahesh Poojary Huawei1cb37fe2015-11-04 11:33:54 +05303 *
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 */
Ray Milkey6c1bac32015-11-13 14:40:40 -080016package org.onosproject.vtnrsc;
17
18import java.util.UUID;
19
20import org.junit.Test;
21
22import com.google.common.testing.EqualsTester;
Mahesh Poojary Huawei1cb37fe2015-11-04 11:33:54 +053023
24import static org.hamcrest.MatcherAssert.assertThat;
25import static org.hamcrest.Matchers.is;
26import static org.hamcrest.Matchers.notNullValue;
27import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
28
Mahesh Poojary Huawei1cb37fe2015-11-04 11:33:54 +053029/**
30 * Unit tests for PortPairGroupId class.
31 */
32public class PortPairGroupIdTest {
33
34 final PortPairGroupId portPairGroupId1 = PortPairGroupId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
35 final PortPairGroupId sameAsPortPairGroupId1 = PortPairGroupId
36 .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
37 final PortPairGroupId portPairGroupId2 = PortPairGroupId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1");
38
39 /**
40 * Checks that the PortPairGroupId class is immutable.
41 */
42 @Test
43 public void testImmutability() {
44 assertThatClassIsImmutable(PortPairGroupId.class);
45 }
46
47 /**
48 * Checks the operation of equals() methods.
49 */
50 @Test
51 public void testEquals() {
52 new EqualsTester().addEqualityGroup(portPairGroupId1, sameAsPortPairGroupId1)
53 .addEqualityGroup(portPairGroupId2).testEquals();
54 }
55
56 /**
57 * Checks the construction of a PortPairGroupId object.
58 */
59 @Test
60 public void testConstruction() {
61 final String portPairGroupIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1";
62 final PortPairGroupId portPairGroupId = PortPairGroupId.of(portPairGroupIdValue);
63 assertThat(portPairGroupId, is(notNullValue()));
64 assertThat(portPairGroupId.value(), is(UUID.fromString(portPairGroupIdValue)));
65 }
66}