|
6 | 6 | import org.junit.Assert; |
7 | 7 | import org.junit.Test; |
8 | 8 | import org.labkey.api.collections.IntHashMap; |
| 9 | +import org.labkey.api.collections.LongArrayList; |
9 | 10 | import org.labkey.api.collections.LongHashMap; |
10 | 11 | import org.labkey.api.exp.api.ExpData; |
11 | 12 | import org.labkey.api.exp.api.ExperimentService; |
|
28 | 29 | import java.io.StringReader; |
29 | 30 | import java.io.StringWriter; |
30 | 31 | import java.util.ArrayList; |
| 32 | +import java.util.Arrays; |
31 | 33 | import java.util.Collection; |
32 | 34 | import java.util.Collections; |
33 | 35 | import java.util.HashMap; |
@@ -319,6 +321,7 @@ public void testSerializeWithMap() throws Exception |
319 | 321 | js1._cachedObjects.put("cachedInt", 1); |
320 | 322 | js1._cachedObjects.put("cachedString", "foo"); |
321 | 323 | js1._cachedObjects.put("cachedLong", 2L); |
| 324 | + js1._cachedObjects.put("cachedListLong", new LongArrayList(Arrays.asList(1L, 2L))); |
322 | 325 |
|
323 | 326 | LongHashMap<Long> longMap = new LongHashMap<>(); |
324 | 327 | longMap.put(1L, 2L); |
@@ -349,10 +352,15 @@ public void testSerializeWithMap() throws Exception |
349 | 352 | assertEquals("Object not serialized with correct key type", Integer.class, serializedMap.keySet().iterator().next().getClass()); |
350 | 353 | assertNotNull("Map keys not serialized properly", serializedMap.get(1)); |
351 | 354 |
|
352 | | - LongHashMap<Long> serializedLongMap = (LongHashMap<Long>)deserialized.getCachedObject("cachedLongMap", LongHashMap.class); |
| 355 | + LongHashMap<Long> serializedLongMap = deserialized.getCachedObject("cachedLongMap", LongHashMap.class); |
353 | 356 | assertEquals("LongMap not serialized properly", 1, serializedLongMap.size()); |
354 | 357 | assertEquals("Object not serialized with correct key type", Long.class, serializedLongMap.keySet().iterator().next().getClass()); |
355 | 358 | assertNotNull("LongMap keys not serialized properly", serializedLongMap.get(1L)); |
| 359 | + |
| 360 | + List<Long> serializedListLong = deserialized.getCachedObject("cachedListLong", mapper.getTypeFactory().constructType(LongArrayList.class)); |
| 361 | + assertEquals("List<Long> not serialized properly", 2, serializedListLong.size()); |
| 362 | + assertNotNull("List<Long> values not serialized properly", serializedListLong.get(1)); |
| 363 | + assertNotNull("List<Long> values not serialized properly", serializedListLong.get(2)); |
356 | 364 | } |
357 | 365 |
|
358 | 366 | @Test |
|
0 commit comments