Created
November 7, 2014 14:23
-
-
Save m0wfo/23b7b4a13a5f22b75632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS) | |
public static class Wrapper { | |
} | |
@Test | |
public void testPolymorphicTypeIsReturnedWithoutMap() throws Exception { | |
Wrapper alertNotifyTag = new Wrapper(); | |
String serialized = mapper.writeValueAsString(alertNotifyTag); | |
System.out.println(serialized); | |
assertTrue(serialized.contains("@class")); | |
} | |
@Test | |
public void testTypeIsReturnedWithMap() throws Exception { | |
Wrapper alertNotifyTag = new Wrapper(); | |
Map<String, Wrapper> map = ImmutableMap.of("something", alertNotifyTag); | |
String serialized = mapper.writeValueAsString(map); | |
System.out.println(serialized); | |
assertTrue(serialized.contains("@class")); // disappears | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment