jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame^] | 1 | package org.onosproject.net.tunnel; |
| 2 | |
| 3 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 4 | |
| 5 | import org.junit.Test; |
| 6 | import org.onlab.packet.IpAddress; |
| 7 | import org.onosproject.core.ApplicationId; |
| 8 | import org.onosproject.core.DefaultApplicationId; |
| 9 | |
| 10 | import com.google.common.testing.EqualsTester; |
| 11 | |
| 12 | /** |
| 13 | * Test of order model entity. |
| 14 | */ |
| 15 | public class TunnelSubscriptionTest { |
| 16 | /** |
| 17 | * Checks that the Order class is immutable. |
| 18 | */ |
| 19 | @Test |
| 20 | public void testImmutability() { |
| 21 | assertThatClassIsImmutable(TunnelSubscription.class); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Checks the operation of equals(), hashCode() and toString() methods. |
| 26 | */ |
| 27 | @Test |
| 28 | public void testEquality() { |
| 29 | TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423)); |
| 30 | TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421)); |
| 31 | ApplicationId appId = new DefaultApplicationId(243, "test"); |
| 32 | ApplicationId appId2 = new DefaultApplicationId(2431, "test1"); |
| 33 | TunnelId tunnelId = TunnelId.valueOf(41654654); |
| 34 | TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, |
| 35 | null); |
| 36 | TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, |
| 37 | null); |
| 38 | TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN, |
| 39 | null); |
| 40 | new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) |
| 41 | .testEquals(); |
| 42 | } |
| 43 | } |