blob: 3a118241d6b11ff76f474a7649b14c0e1f79c14e [file] [log] [blame]
samueljcc67b85a92015-10-27 17:21:15 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
samueljcc67b85a92015-10-27 17:21:15 -07003 *
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 org.junit.Test;
19
20import com.google.common.testing.EqualsTester;
samueljcc67b85a92015-10-27 17:21:15 -070021
22import static org.hamcrest.MatcherAssert.assertThat;
23import static org.hamcrest.Matchers.is;
24import static org.hamcrest.Matchers.notNullValue;
25import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
26
samueljcc67b85a92015-10-27 17:21:15 -070027/**
28 * Unit tests for TenantNetworkId class.
29 */
30public class TenantNetworkIdTest {
31
32 final TenantNetworkId networkId1 = TenantNetworkId.networkId("1");
33 final TenantNetworkId sameAsnetworkId1 = TenantNetworkId.networkId("1");
34 final TenantNetworkId networkId2 = TenantNetworkId.networkId("2");
35
36 /**
37 * Checks that the TenantNetworkId class is immutable.
38 */
39 @Test
40 public void testImmutability() {
41 assertThatClassIsImmutable(TenantNetworkId.class);
42 }
43
44 /**
45 * Checks the operation of equals() methods.
46 */
47 @Test
48 public void testEquals() {
49 new EqualsTester().addEqualityGroup(networkId1, sameAsnetworkId1)
50 .addEqualityGroup(networkId2).testEquals();
51 }
52
53 /**
54 * Checks the construction of a TenantNetworkId object.
55 */
56 @Test
57 public void testConstruction() {
58 final String networkIdValue = "s";
59 final TenantNetworkId networkId = TenantNetworkId.networkId(networkIdValue);
60 assertThat(networkId, is(notNullValue()));
61 assertThat(networkId.networkId(), is(networkIdValue));
62 }
63}