DXJSON { public static ObjectBuilder getObjectBuilder() { return new ObjectBuilder(); } private  DXJSON(); static JsonNode parseJson(String stringified); static ArrayBuilder getArrayBuilder(); static ObjectBuilder getObjectBuilder(); static T safeTreeToValue(JsonNode json, Class<T> valueType);  }
@Test public void testJsonObjects() throws IOException { ObjectNode actual1 = DXJSON.getObjectBuilder().build(); ObjectNode expected1 = new MappingJsonFactory().createParser("{}").readValueAsTree(); Assert.assertEquals(expected1, actual1); Assert.assertEquals(expected1.toString(), "{}"); ObjectNode actual2 = DXJSON.getObjectBuilder().put("key1", "a-string").put("key2", 12321).build(); ObjectNode expected2 = new MappingJsonFactory().createParser("{\"key1\": \"a-string\", \"key2\": 12321}") .readValueAsTree(); Assert.assertEquals(expected2, actual2); }