blob: 22be66466c3aa63f73274cc405127e687420577d [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;
Brian Stanke7a81b532016-06-14 15:43:51 -040021import org.onosproject.net.TestDeviceParams;
Brian Stanke0e5c94e2016-03-08 11:20:04 -050022
23import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
24
25/**
26 * Test of the default virtual device model entity.
27 */
Brian Stanke7a81b532016-06-14 15:43:51 -040028public class DefaultVirtualDeviceTest extends TestDeviceParams {
Brian Stanke0e5c94e2016-03-08 11:20:04 -050029
30 /**
31 * Checks that the DefaultVirtualDevice class is immutable.
32 */
33 @Test
34 public void testImmutability() {
35 assertThatClassIsImmutable(DefaultVirtualDevice.class);
36 }
37
38 @Test
39 public void testEquality() {
40 DefaultVirtualDevice device1 =
Brian Stanke7a81b532016-06-14 15:43:51 -040041 new DefaultVirtualDevice(NetworkId.networkId(0), DID1);
Brian Stanke0e5c94e2016-03-08 11:20:04 -050042 DefaultVirtualDevice device2 =
Brian Stanke7a81b532016-06-14 15:43:51 -040043 new DefaultVirtualDevice(NetworkId.networkId(0), DID1);
Brian Stanke0e5c94e2016-03-08 11:20:04 -050044 DefaultVirtualDevice device3 =
Brian Stanke7a81b532016-06-14 15:43:51 -040045 new DefaultVirtualDevice(NetworkId.networkId(0), DID2);
Brian Stanke0e5c94e2016-03-08 11:20:04 -050046 DefaultVirtualDevice device4 =
Brian Stanke7a81b532016-06-14 15:43:51 -040047 new DefaultVirtualDevice(NetworkId.networkId(1), DID1);
Brian Stanke0e5c94e2016-03-08 11:20:04 -050048
49 new EqualsTester().addEqualityGroup(device1, device2).addEqualityGroup(device3)
50 .addEqualityGroup(device4).testEquals();
51 }
52}