public static ObjectNode readTreeFromStream(ObjectMapper mapper, InputStream stream) throws IOException {
        return  nullIsIllegal((ObjectNode) mapper.readTree(stream), INPUT_JSON_CANNOT_BE_NULL);
    }
@Test
    public void testReadTreeFromStream() throws Exception {
        InputStream stream = new ByteArrayInputStream(Tools.getBytesUtf8("{\"foo\" : \"bar\"}"));
        ObjectNode obj = Tools.readTreeFromStream(new ObjectMapper(), stream);
        assertTrue(obj.has("foo"));
        assertThat(obj.get("foo").asText(), is("bar"));
    }