JsonNodeSerializer { public String serialize(final Node node) throws RepositoryException { Map<String, Object> tree = getNodeMap(node); traversToMap(node, tree); return tree.toString(); }  String serialize(final Node node);  }
@Test public void shouldSerializeChildNodeProperties() throws RepositoryException { String result = new JsonNodeSerializer().serialize(node); assertThat(result) .as("Child node's properties should be serialized") .contains(CHILD_PROP) .contains(CHILD_VALUE); }
@Test public void shouldOmitProperties() throws RepositoryException { String result = new JsonNodeSerializer().serialize(node); assertThat(result) .as("Auto created properties should not be used for serialization") .doesNotContain("jcr:created"); }
@Test public void shouldReturnNonEmptyString() throws RepositoryException { String result = new JsonNodeSerializer().serialize(node); assertThat(result) .as("Result of node's serialization should not be empty") .isNotEmpty(); }
@Test public void shouldSerializeNodeName() throws RepositoryException { String result = new JsonNodeSerializer().serialize(node); assertThat(result) .as("Node's name should be serialized") .contains(RESOURCE_NAME); }
@Test public void shouldSerializeNodeProperties() throws RepositoryException { String result = new JsonNodeSerializer().serialize(node); assertThat(result) .as("Node's properties should be serialized") .contains(PARENT_PROP) .contains(PARENT_VALUE); }
@Test public void shouldSerializeChildNodeName() throws RepositoryException { String result = new JsonNodeSerializer().serialize(node); assertThat(result) .as("Child node's name should be serialized") .contains(CHILD_RESOURCE_NAME); }