Fix unit test issue
Change-Id: Ie0809591652a22379e59cd5f80b7cddb3896459d
Showing
2 changed files
with
7 additions
and
5 deletions
... | @@ -39,7 +39,7 @@ public class DeviceEventTest extends AbstractEventTest { | ... | @@ -39,7 +39,7 @@ public class DeviceEventTest extends AbstractEventTest { |
39 | Device device = createDevice(); | 39 | Device device = createDevice(); |
40 | Port port = new DefaultPort(device, PortNumber.portNumber(123), true); | 40 | Port port = new DefaultPort(device, PortNumber.portNumber(123), true); |
41 | long before = System.currentTimeMillis(); | 41 | long before = System.currentTimeMillis(); |
42 | - DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device); | 42 | + DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device, port); |
43 | long after = System.currentTimeMillis(); | 43 | long after = System.currentTimeMillis(); |
44 | validateEvent(event, DeviceEvent.Type.DEVICE_ADDED, device, before, after); | 44 | validateEvent(event, DeviceEvent.Type.DEVICE_ADDED, device, before, after); |
45 | } | 45 | } | ... | ... |
... | @@ -34,7 +34,8 @@ import com.google.common.collect.ImmutableMap; | ... | @@ -34,7 +34,8 @@ import com.google.common.collect.ImmutableMap; |
34 | import com.google.common.collect.ImmutableSet; | 34 | import com.google.common.collect.ImmutableSet; |
35 | import com.google.common.testing.EqualsTester; | 35 | import com.google.common.testing.EqualsTester; |
36 | 36 | ||
37 | -public class KryoSerializerTests { | 37 | +public class KryoSerializerTest { |
38 | + | ||
38 | private static final ProviderId PID = new ProviderId("of", "foo"); | 39 | private static final ProviderId PID = new ProviderId("of", "foo"); |
39 | private static final ProviderId PIDA = new ProviderId("of", "foo", true); | 40 | private static final ProviderId PIDA = new ProviderId("of", "foo", true); |
40 | private static final DeviceId DID1 = deviceId("of:foo"); | 41 | private static final DeviceId DID1 = deviceId("of:foo"); |
... | @@ -92,7 +93,7 @@ public class KryoSerializerTests { | ... | @@ -92,7 +93,7 @@ public class KryoSerializerTests { |
92 | 93 | ||
93 | 94 | ||
94 | @Test | 95 | @Test |
95 | - public final void test() { | 96 | + public final void testSerialization() { |
96 | testSerialized(new ConnectPoint(DID1, P1)); | 97 | testSerialized(new ConnectPoint(DID1, P1)); |
97 | testSerialized(new DefaultLink(PID, CP1, CP2, Link.Type.DIRECT)); | 98 | testSerialized(new DefaultLink(PID, CP1, CP2, Link.Type.DIRECT)); |
98 | testSerialized(new DefaultPort(DEV1, P1, true)); | 99 | testSerialized(new DefaultPort(DEV1, P1, true)); |
... | @@ -119,6 +120,7 @@ public class KryoSerializerTests { | ... | @@ -119,6 +120,7 @@ public class KryoSerializerTests { |
119 | } | 120 | } |
120 | } | 121 | } |
121 | 122 | ||
123 | + @Test | ||
122 | public final void testAnnotations() { | 124 | public final void testAnnotations() { |
123 | // Annotations does not have equals defined, manually test equality | 125 | // Annotations does not have equals defined, manually test equality |
124 | final byte[] a1Bytes = kryos.serialize(A1); | 126 | final byte[] a1Bytes = kryos.serialize(A1); |
... | @@ -132,9 +134,9 @@ public class KryoSerializerTests { | ... | @@ -132,9 +134,9 @@ public class KryoSerializerTests { |
132 | 134 | ||
133 | // code clone | 135 | // code clone |
134 | public static void assertAnnotationsEquals(Annotations actual, SparseAnnotations... annotations) { | 136 | public static void assertAnnotationsEquals(Annotations actual, SparseAnnotations... annotations) { |
135 | - DefaultAnnotations expected = DefaultAnnotations.builder().build(); | 137 | + SparseAnnotations expected = DefaultAnnotations.builder().build(); |
136 | for (SparseAnnotations a : annotations) { | 138 | for (SparseAnnotations a : annotations) { |
137 | - expected = DefaultAnnotations.merge(expected, a); | 139 | + expected = DefaultAnnotations.union(expected, a); |
138 | } | 140 | } |
139 | assertEquals(expected.keys(), actual.keys()); | 141 | assertEquals(expected.keys(), actual.keys()); |
140 | for (String key : expected.keys()) { | 142 | for (String key : expected.keys()) { | ... | ... |
-
Please register or login to post a comment