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