Ejemplo n.º 1
0
 public void testEmbeddedObject() throws Exception {
   TokenBuffer buf = new TokenBuffer(MAPPER);
   buf.writeObject(new byte[3]);
   JsonNode node = MAPPER.readTree(buf.asParser());
   buf.close();
   assertTrue(node.isBinary());
   byte[] data = node.binaryValue();
   assertNotNull(data);
   assertEquals(3, data.length);
 }
Ejemplo n.º 2
0
 public void testEmbeddedObjectInArray() throws Exception {
   TokenBuffer buf = new TokenBuffer(MAPPER);
   buf.writeStartArray();
   buf.writeObject(MARKER);
   buf.writeEndArray();
   JsonNode node = MAPPER.readTree(buf.asParser());
   buf.close();
   assertTrue(node.isArray());
   assertEquals(1, node.size());
   JsonNode n = node.get(0);
   assertTrue(n.isPojo());
   assertSame(MARKER, ((POJONode) n).getPojo());
 }