blob: 7fcf70dd7cfc80dea86b4d6f988d6438e86a7df4 [file] [log] [blame]
Brian Stanke7a81b532016-06-14 15:43:51 -04001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Brian Stanke7a81b532016-06-14 15:43:51 -04003 *
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;
21import org.onosproject.net.TestDeviceParams;
22
23import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
24
25/**
26 * Test of the default virtual host model entity.
27 */
28public 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}