Skip to content

Instantly share code, notes, and snippets.

@tkobayas
Created December 26, 2016 00:56
Show Gist options
  • Save tkobayas/1fac568d9544fe894c919b558f07421f to your computer and use it in GitHub Desktop.
Save tkobayas/1fac568d9544fe894c919b558f07421f to your computer and use it in GitHub Desktop.
@Test
public void testJSONTypeInfoTopLevelOnly() {
Marshaller marshaller = MarshallerFactory.getMarshaller( getCustomClasses(), MarshallingFormat.JSON, getClass().getClassLoader() );
String rawContent = "{\"org.kie.server.api.marshalling.objects.PojoA\": "
+ "{\"name\": \"A\","
+ " \"pojoBList\":"
+ " [{\"name\": \"B1\","
+ " \"pojoCList\":"
+ " ["
+ " {\"name\": \"C1\"}, "
+ " {\"name\": \"C2\"}"
+ " ]"
+ " },"
+ " {\"name\": \"B2\","
+ " \"pojoCList\":"
+ " ["
+ " {\"name\": \"C3\"}"
+ " ]"
+ " }"
+ " ],"
+ " \"stringList\":"
+ " [\"Hello\", \"Bye\"]"
+ "}}";
Object unmarshalledObject = marshaller.unmarshall( rawContent, PojoA.class );
Assertions.assertThat( unmarshalledObject ).isEqualTo( createTestObject() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment