blob: c8f79b1e3140ed27b83651be2ceeb060e027842a [file] [log] [blame]
Brian Stanke0e5c94e2016-03-08 11:20:04 -05001/*
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.incubator.net.virtual;
18
19import com.google.common.testing.EqualsTester;
20import org.junit.Test;
21
22import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
23
24/**
25 * Test of the default virtual network model entity.
26 */
27public class DefaultVirtualNetworkTest {
28 final String tenantIdValue1 = "TENANT_ID1";
29 final String tenantIdValue2 = "TENANT_ID2";
30
31 /**
32 * Checks that the DefaultVirtualNetwork class is immutable.
33 */
34 @Test
35 public void testImmutability() {
36 assertThatClassIsImmutable(DefaultVirtualNetwork.class);
37 }
38
39 @Test
40 public void testEquality() {
41 DefaultVirtualNetwork network1 =
42 new DefaultVirtualNetwork(NetworkId.networkId(0), TenantId.tenantId(tenantIdValue1));
43 DefaultVirtualNetwork network2 =
44 new DefaultVirtualNetwork(NetworkId.networkId(0), TenantId.tenantId(tenantIdValue1));
45 DefaultVirtualNetwork network3 =
46 new DefaultVirtualNetwork(NetworkId.networkId(0), TenantId.tenantId(tenantIdValue2));
47 DefaultVirtualNetwork network4 =
48 new DefaultVirtualNetwork(NetworkId.networkId(1), TenantId.tenantId(tenantIdValue2));
49
50 new EqualsTester().addEqualityGroup(network1, network2).addEqualityGroup(network3)
51 .addEqualityGroup(network4).testEquals();
52 }
53}