Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [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 | 7a81b53 | 2016-06-14 15:43:51 -0400 | [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; |
| 21 | import org.onosproject.net.TestDeviceParams; |
| 22 | |
| 23 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 24 | |
| 25 | /** |
| 26 | * Test of the default virtual host model entity. |
| 27 | */ |
| 28 | public class DefaultVirtualHostTest extends TestDeviceParams { |
| 29 | |
| 30 | /** |
| 31 | * Checks that the DefaultVirtualHost class is immutable. |
| 32 | */ |
| 33 | @Test |
| 34 | public void testImmutability() { |
| 35 | assertThatClassIsImmutable(DefaultVirtualHost.class); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Tests the DefaultVirtualHost equality method. |
| 40 | */ |
| 41 | @Test |
| 42 | public void testEquality() { |
| 43 | DefaultVirtualHost host1 = |
| 44 | new DefaultVirtualHost(NetworkId.networkId(0), HID1, MAC1, VLAN1, LOC1, IPSET1); |
| 45 | DefaultVirtualHost host2 = |
| 46 | new DefaultVirtualHost(NetworkId.networkId(0), HID1, MAC1, VLAN1, LOC1, IPSET1); |
| 47 | DefaultVirtualHost host3 = |
| 48 | new DefaultVirtualHost(NetworkId.networkId(0), HID2, MAC1, VLAN1, LOC1, IPSET1); |
| 49 | DefaultVirtualHost host4 = |
| 50 | new DefaultVirtualHost(NetworkId.networkId(1), HID2, MAC1, VLAN1, LOC1, IPSET1); |
| 51 | |
| 52 | new EqualsTester().addEqualityGroup(host1, host2).addEqualityGroup(host3) |
| 53 | .addEqualityGroup(host4).testEquals(); |
| 54 | } |
| 55 | } |