blob: 682796a790f63ed9e7903b10b8e871ad22b80ed1 [file] [log] [blame]
jcc4a20a5f2015-04-30 15:43:39 +08001package org.onosproject.net.tunnel;
2
3import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
4
5import org.junit.Test;
6import org.onlab.packet.IpAddress;
7import org.onosproject.core.ApplicationId;
8import org.onosproject.core.DefaultApplicationId;
9
10import com.google.common.testing.EqualsTester;
11
12/**
13 * Test of order model entity.
14 */
15public 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}