blob: 2da07766dbb5fa37174cef06573ee3f44e2e85e9 [file] [log] [blame]
samueljcc1e4589d2015-10-27 17:19:41 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
samueljcc1e4589d2015-10-27 17:19:41 -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;
samueljcc1e4589d2015-10-27 17:19:41 -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
samueljcc1e4589d2015-10-27 17:19:41 -070027/**
28 * Unit tests for PhysicalNetwork class.
29 */
30public class PhysicalNetworkTest {
31
32 final PhysicalNetwork physicalNetwork1 = PhysicalNetwork.physicalNetwork("1");
33 final PhysicalNetwork sameAsPhysicalNetwork1 = PhysicalNetwork.physicalNetwork("1");
34 final PhysicalNetwork physicalNetwork2 = PhysicalNetwork.physicalNetwork("2");
35
36 /**
37 * Checks that the PhysicalNetwork class is immutable.
38 */
39 @Test
40 public void testImmutability() {
41 assertThatClassIsImmutable(PhysicalNetwork.class);
42 }
43
44 /**
45 * Checks the operation of equals() methods.
46 */
47 @Test
48 public void testEquals() {
49 new EqualsTester().addEqualityGroup(physicalNetwork1, sameAsPhysicalNetwork1)
50 .addEqualityGroup(physicalNetwork2).testEquals();
51 }
52
53 /**
54 * Checks the construction of a PhysicalNetwork object.
55 */
56 @Test
57 public void testConstruction() {
58 final String physicalNetworkValue = "s";
59 final PhysicalNetwork physicalNetwork = PhysicalNetwork
60 .physicalNetwork(physicalNetworkValue);
61 assertThat(physicalNetwork, is(notNullValue()));
62 assertThat(physicalNetwork.physicalNetwork(), is(physicalNetworkValue));
63 }
64}