### Question:
JsonUtil { public static Iterator<JsonNode> parser(final InputStream stream) { try { JsonParser parser = FACTORY.createParser(stream); parser.setCodec(new ObjectMapper()); return parser.readValuesAs(JsonNode.class); } catch (IOException e) { throw new DatasetIOException("Cannot read from stream", e); } }  static Iterator<JsonNode> parser(final InputStream stream); static JsonNode parse(String json); static T parse(String json, Class<T> returnType); static JsonNode parse(File file); static T parse(File file, Class<T> returnType); static JsonNode parse(InputStream in); static T parse(InputStream in, Class<T> returnType); @edu.umd.cs.findbugs.annotations.SuppressWarnings( value="BC_UNCONFIRMED_CAST", justification="Uses precondition to validate casts") static T visit(JsonNode node, JsonTreeVisitor<T> visitor); static Object convertToAvro(GenericData model, JsonNode datum,
                                     Schema schema); static Schema inferSchema(InputStream incoming, final String name,
                                   int numRecords); static Schema inferSchema(JsonNode node, String name); static Schema inferSchemaWithMaps(JsonNode node, String name);  }### Answer:
@Test public void testJsonStream() throws Exception { String jsonSample = "{\"id\": 1}\n{\"id\": 2}"; Iterator<JsonNode> iter = JsonUtil.parser( new ByteArrayInputStream(jsonSample.getBytes("utf-8"))); Assert.assertEquals("Should produce 2 records", 2, Lists.newArrayList(iter).size()); jsonSample = "{\"id\": 1}{\"id\": 2}"; iter = JsonUtil.parser( new ByteArrayInputStream(jsonSample.getBytes("utf-8"))); Assert.assertEquals("Should produce 2 records", 2, Lists.newArrayList(iter).size()); jsonSample = "{\"id\": 1} {\"id\": 2}"; iter = JsonUtil.parser( new ByteArrayInputStream(jsonSample.getBytes("utf-8"))); Assert.assertEquals("Should produce 2 records", 2, Lists.newArrayList(iter).size()); jsonSample = "{\"id\": 1}\t{\"id\": 2}"; iter = JsonUtil.parser( new ByteArrayInputStream(jsonSample.getBytes("utf-8"))); Assert.assertEquals("Should produce 2 records", 2, Lists.newArrayList(iter).size()); }