|
3 | 3 | import java.util.Iterator;
|
4 | 4 |
|
5 | 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
| 6 | + |
6 | 7 | import com.fasterxml.jackson.core.type.TypeReference;
|
| 8 | + |
7 | 9 | import com.fasterxml.jackson.databind.DeserializationFeature;
|
8 | 10 | import com.fasterxml.jackson.databind.JavaType;
|
9 | 11 | import com.fasterxml.jackson.databind.JsonMappingException;
|
10 | 12 | import com.fasterxml.jackson.databind.ObjectMapper;
|
| 13 | + |
11 | 14 | import com.google.common.collect.*;
|
12 | 15 |
|
13 | 16 | /**
|
14 | 17 | * Unit tests for verifying that various immutable types
|
15 | 18 | * (like {@link ImmutableList}, {@link ImmutableMap} and {@link ImmutableSet})
|
16 | 19 | * work as expected.
|
17 |
| - * |
18 |
| - * @author tsaloranta |
19 | 20 | */
|
20 | 21 | public class TestImmutables extends ModuleTestBase
|
21 | 22 | {
|
@@ -54,6 +55,14 @@ public void testWithoutSerializers() throws Exception
|
54 | 55 | ImmutableMap<String,Integer> map = ImmutableMap.<String,Integer>builder()
|
55 | 56 | .put("a", 1).put("b", 2).build();
|
56 | 57 | assertEquals("{\"a\":1,\"b\":2}", MAPPER.writeValueAsString(map));
|
| 58 | + |
| 59 | + assertEquals(a2q("{'message':'Hello, world!'}"), |
| 60 | + MAPPER.writeValueAsString(ImmutableMap.of("message", "Hello, world!"))); |
| 61 | + assertEquals(a2q("{'id':3,'name':'Bob'}"), |
| 62 | + MAPPER.writeValueAsString(ImmutableMap.of("id", 3, "name", "Bob"))); |
| 63 | + |
| 64 | + assertEquals("[12,true,0.25]", |
| 65 | + MAPPER.writeValueAsString(ImmutableList.of(12, true, 0.25))); |
57 | 66 | }
|
58 | 67 |
|
59 | 68 | /**
|
|
0 commit comments