tom | 5a9383a | 2014-10-02 07:33:52 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net; |
| 2 | |
| 3 | import com.google.common.testing.EqualsTester; |
| 4 | import org.junit.Test; |
| 5 | |
tom | 747a213 | 2014-10-02 08:18:41 -0700 | [diff] [blame^] | 6 | import static org.junit.Assert.assertEquals; |
tom | 5a9383a | 2014-10-02 07:33:52 -0700 | [diff] [blame] | 7 | import static org.onlab.onos.net.DeviceId.deviceId; |
| 8 | import static org.onlab.onos.net.PortNumber.portNumber; |
| 9 | |
| 10 | /** |
| 11 | * Test of the connetion point entity. |
| 12 | */ |
| 13 | public class ConnectPointTest { |
| 14 | |
tom | 747a213 | 2014-10-02 08:18:41 -0700 | [diff] [blame^] | 15 | private static final DeviceId DID1 = deviceId("1"); |
| 16 | private static final DeviceId DID2 = deviceId("2"); |
| 17 | private static final PortNumber P1 = portNumber(1); |
| 18 | private static final PortNumber P2 = portNumber(2); |
tom | 5a9383a | 2014-10-02 07:33:52 -0700 | [diff] [blame] | 19 | |
| 20 | @Test |
| 21 | public void basics() { |
| 22 | ConnectPoint p = new ConnectPoint(DID1, P2); |
| 23 | assertEquals("incorrect element id", DID1, p.deviceId()); |
| 24 | assertEquals("incorrect element id", P2, p.port()); |
| 25 | } |
| 26 | |
| 27 | |
| 28 | @Test |
| 29 | public void testEquality() { |
| 30 | new EqualsTester() |
| 31 | .addEqualityGroup(new ConnectPoint(DID1, P1), new ConnectPoint(DID1, P1)) |
| 32 | .addEqualityGroup(new ConnectPoint(DID1, P2), new ConnectPoint(DID1, P2)) |
| 33 | .addEqualityGroup(new ConnectPoint(DID2, P1), new ConnectPoint(DID2, P1)) |
| 34 | .testEquals(); |
| 35 | } |
| 36 | } |