### Question:
JacksonUtils { public static JsonNode toJsonNode(Object datum) { if (datum == null) { return null; } try { TokenBuffer generator = new TokenBuffer(new ObjectMapper(), false); toJson(datum, generator); return new ObjectMapper().readTree(generator.asParser()); } catch (IOException e) { throw new AvroRuntimeException(e); } } private  JacksonUtils(); static JsonNode toJsonNode(Object datum); static Object toObject(JsonNode jsonNode); static Object toObject(JsonNode jsonNode, Schema schema); static Map objectToMap(Object datum);  }### Answer:
@Test public void testToJsonNode() { assertEquals(null, toJsonNode(null)); assertEquals(NullNode.getInstance(), toJsonNode(JsonProperties.NULL_VALUE)); assertEquals(BooleanNode.TRUE, toJsonNode(true)); assertEquals(IntNode.valueOf(1), toJsonNode(1)); assertEquals(LongNode.valueOf(2), toJsonNode(2L)); assertEquals(FloatNode.valueOf(1.0f), toJsonNode(1.0f)); assertEquals(DoubleNode.valueOf(2.0), toJsonNode(2.0)); assertEquals(TextNode.valueOf("\u0001\u0002"), toJsonNode(new byte[] { 1, 2 })); assertEquals(TextNode.valueOf("a"), toJsonNode("a")); assertEquals(TextNode.valueOf("UP"), toJsonNode(Direction.UP)); assertEquals(BigIntegerNode.valueOf(BigInteger.ONE), toJsonNode(BigInteger.ONE)); assertEquals(DecimalNode.valueOf(BigDecimal.ONE), toJsonNode(BigDecimal.ONE)); ArrayNode an = JsonNodeFactory.instance.arrayNode(); an.add(1); assertEquals(an, toJsonNode(Collections.singletonList(1))); ObjectNode on = JsonNodeFactory.instance.objectNode(); on.put("a", 1); assertEquals(on, toJsonNode(Collections.singletonMap("a", 1))); }