@Test public void whenSerializeCheckDataParsing() throws Exception { String inputJson = "json_canonicalization/test_input.json"; JsonNode initialJson = JsonHandler.getFromInputStream(PropertiesUtils.getResourceAsStream(inputJson)); JsonNode canonicalJson = JsonHandler.getFromInputStream(CanonicalJsonFormatter.serialize(initialJson)); JsonAssert.assertJsonEquals(initialJson.toString(), canonicalJson.toString()); }
public static InputStream serialize(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toInputStream(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } }
CanonicalJsonFormatter { public static InputStream serialize(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toInputStream(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } }
CanonicalJsonFormatter { public static InputStream serialize(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toInputStream(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } private  CanonicalJsonFormatter(OutputStreamWriter writer); }
CanonicalJsonFormatter { public static InputStream serialize(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toInputStream(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } private  CanonicalJsonFormatter(OutputStreamWriter writer); static InputStream serialize(JsonNode node); static byte[] serializeToByteArray(JsonNode node); static void serialize(JsonNode node, OutputStream outputStream); }
CanonicalJsonFormatter { public static InputStream serialize(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toInputStream(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } private  CanonicalJsonFormatter(OutputStreamWriter writer); static InputStream serialize(JsonNode node); static byte[] serializeToByteArray(JsonNode node); static void serialize(JsonNode node, OutputStream outputStream);  }