@Test void testConvertNodeToBytes() throws Exception { final String content = "{\"someKey\":\"someValue\",\"someOther\":true}"; JsonNode expected = objectMapper.readTree(content); assertEquals(expected, testSubject.convert(content.getBytes(IOUtils.UTF8))); }
@Override public JsonNode convert(byte[] original) { try { return objectMapper.readTree(original); } catch (IOException e) { throw new CannotConvertBetweenTypesException("An error occurred while converting a JsonNode to byte[]", e); } }
ByteArrayToJsonNodeConverter implements ContentTypeConverter<byte[],JsonNode> { @Override public JsonNode convert(byte[] original) { try { return objectMapper.readTree(original); } catch (IOException e) { throw new CannotConvertBetweenTypesException("An error occurred while converting a JsonNode to byte[]", e); } } }
ByteArrayToJsonNodeConverter implements ContentTypeConverter<byte[],JsonNode> { @Override public JsonNode convert(byte[] original) { try { return objectMapper.readTree(original); } catch (IOException e) { throw new CannotConvertBetweenTypesException("An error occurred while converting a JsonNode to byte[]", e); } } ByteArrayToJsonNodeConverter(ObjectMapper objectMapper); }
ByteArrayToJsonNodeConverter implements ContentTypeConverter<byte[],JsonNode> { @Override public JsonNode convert(byte[] original) { try { return objectMapper.readTree(original); } catch (IOException e) { throw new CannotConvertBetweenTypesException("An error occurred while converting a JsonNode to byte[]", e); } } ByteArrayToJsonNodeConverter(ObjectMapper objectMapper); @Override Class<byte[]> expectedSourceType(); @Override Class<JsonNode> targetType(); @Override JsonNode convert(byte[] original); }
ByteArrayToJsonNodeConverter implements ContentTypeConverter<byte[],JsonNode> { @Override public JsonNode convert(byte[] original) { try { return objectMapper.readTree(original); } catch (IOException e) { throw new CannotConvertBetweenTypesException("An error occurred while converting a JsonNode to byte[]", e); } } ByteArrayToJsonNodeConverter(ObjectMapper objectMapper); @Override Class<byte[]> expectedSourceType(); @Override Class<JsonNode> targetType(); @Override JsonNode convert(byte[] original);  }