JsonUtil { public static ObjectNode objectNode() { return FACTORY.objectNode(); } private  JsonUtil(); static ObjectNode objectNode(); static ObjectNode createNode( String key, Object value ); static String toJson( Object value ); static T fromJson( String json, Class<T> type ); static byte[] toCbor( Object value ); static T fromCbor( byte data[], Class<T> type ); static void addAll( ArrayNode arr, Collection<String> list ); static final ObjectMapper MAPPER; }
@Test public void testGetObjectNode() { ObjectNode person = JsonUtil.objectNode(); assertNotNull( person ); person.put( "name", "Subutai" ); person.put( "age", 50 ); person.put( "legend", true ); assertEquals( "Subutai", person.get( "name" ).asText() ); assertEquals( 50, person.get( "age" ).asInt() ); assertEquals( true, person.get( "legend" ).asBoolean() ); }