Hyunsun Moon | 2c3f0ee | 2017-04-06 16:47:21 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Laboratory |
| 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 | package org.opencord.cordvtn.impl; |
| 17 | |
| 18 | import com.google.common.testing.EqualsTester; |
| 19 | import org.junit.Test; |
| 20 | import org.onosproject.net.Device; |
| 21 | import org.opencord.cordvtn.api.node.CordVtnNode; |
| 22 | |
| 23 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 24 | import static org.opencord.cordvtn.api.node.CordVtnNodeState.COMPLETE; |
| 25 | import static org.opencord.cordvtn.api.node.CordVtnNodeState.INIT; |
| 26 | |
| 27 | /** |
| 28 | * Unit test of {@link DefaultCordVtnNode} model entity. |
| 29 | */ |
| 30 | public 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 | } |