Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.incubator.net.virtual; |
| 18 | |
| 19 | import com.google.common.testing.EqualsTester; |
| 20 | import org.junit.Test; |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame^] | 21 | import org.onosproject.net.TenantId; |
Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 22 | |
| 23 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 24 | |
| 25 | /** |
| 26 | * Test of the default virtual network model entity. |
| 27 | */ |
| 28 | public 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 | } |