blob: b1b31ed3b3cb29999ba87f8c9ea51fe1a0f9d771 [file] [log] [blame]
Hyunsun Moon2c3f0ee2017-04-06 16:47:21 +09001/*
Brian O'Connor80dff972017-08-03 22:46:30 -07002 * Copyright 2017-present Open Networking Foundation
Hyunsun Moon2c3f0ee2017-04-06 16:47:21 +09003 *
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 */
16package org.opencord.cordvtn.impl;
17
18import com.google.common.testing.EqualsTester;
19import org.junit.Test;
20import org.onosproject.net.Device;
21import org.opencord.cordvtn.api.node.CordVtnNode;
22
23import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
24import static org.opencord.cordvtn.api.node.CordVtnNodeState.COMPLETE;
25import static org.opencord.cordvtn.api.node.CordVtnNodeState.INIT;
26
27/**
28 * Unit test of {@link DefaultCordVtnNode} model entity.
29 */
30public class DefaultCordVtnNodeTest extends CordVtnNodeTest {
31
32 private static final Device OF_DEVICE_1 = createDevice(1);
33 private static final CordVtnNode NODE_1 = createNode("node-01", OF_DEVICE_1, INIT);
34 private static final CordVtnNode NODE_2 = createNode("node-01", OF_DEVICE_1, COMPLETE);
35 private static final CordVtnNode NODE_3 = createNode("node-03", OF_DEVICE_1, INIT);
36
37 @Test
38 public void testImmutability() {
39 assertThatClassIsImmutable(DefaultCordVtnNode.class);
40 }
41
42 @Test
43 public void testEquality() {
44 new EqualsTester().addEqualityGroup(NODE_1, NODE_2)
45 .addEqualityGroup(NODE_3)
46 .testEquals();
47 }
48}