Initial tests
diff --git a/remote-content-api/document-aggregator/pom.xml b/remote-content-api/document-aggregator/pom.xml
index cad67f9..800805b 100644
--- a/remote-content-api/document-aggregator/pom.xml
+++ b/remote-content-api/document-aggregator/pom.xml
@@ -85,6 +85,30 @@
       <version>16.0.3</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter</artifactId>
+      <version>5.5.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <version>5.5.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.jayway.jsonpath</groupId>
+      <artifactId>json-path</artifactId>
+      <version>2.5.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.jayway.jsonpath</groupId>
+      <artifactId>json-path-assert</artifactId>
+      <version>2.5.0</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/remote-content-api/document-aggregator/src/test/java/org/apache/sling/documentaggregator/impl/JsonDocumentNodeTest.java b/remote-content-api/document-aggregator/src/test/java/org/apache/sling/documentaggregator/impl/JsonDocumentNodeTest.java
new file mode 100644
index 0000000..bdc5540
--- /dev/null
+++ b/remote-content-api/document-aggregator/src/test/java/org/apache/sling/documentaggregator/impl/JsonDocumentNodeTest.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ package org.apache.sling.documentaggregator.impl;
+
+import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Map;
+
+import org.apache.sling.documentaggregator.api.DocumentTree;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+import org.junit.jupiter.api.BeforeEach;
+
+public class JsonDocumentNodeTest {
+
+    private JsonDocumentNode node;
+
+    @BeforeEach
+    public void setup() {
+        node = new JsonDocumentNode("name");
+    }
+
+    @Test
+    public void emptyNode() {
+        assertEquals("{}", node.adaptTo(String.class));
+    }
+    
+    @Test
+    public void withChild() {
+        final DocumentTree.DocumentNode child = node.addChild("child");
+        child.addValue("foo", "bar");
+        child.addValue("number", 42);
+        child.addValue("boolean", false);
+        final String json = node.adaptTo(String.class);
+        assertThat(json, hasJsonPath("child.foo", equalTo("bar")));
+        assertThat(json, hasJsonPath("child.number", equalTo("42")));
+        assertThat(json, hasJsonPath("child.boolean", equalTo("false")));
+    }
+
+    public void withChildLevels() {
+        final DocumentTree.DocumentNode child = node.addChild("one").addChild("two").addChild("three");
+        child.addValue("foo", "barre");
+        final String json = node.adaptTo(String.class);
+        assertThat(json, hasJsonPath("child.one.two.three", equalTo("barre")));
+    }
+
+    @Test
+    public void withArray() {
+        final DocumentTree.DocumentNode child = node.addChild("child");
+        child.addValue("foo", new String [] { "one", "two", "three"});
+        final String json = node.adaptTo(String.class);
+        assertThat(json, hasJsonPath("child.foo", equalTo("[one, two, three]")));
+    }
+
+    @Test
+    public void withArrayAndExtraCloseCall() {
+        final DocumentTree.DocumentNode child = node.addChild("child");
+        child.addValue("foo", new String [] { "one", "two", "three"});
+        child.close();
+        node.close();
+        node.close();
+        final String json = node.adaptTo(String.class);
+        assertThat(json, hasJsonPath("child.foo", equalTo("[one, two, three]")));
+    }
+
+    @Test
+    public void wrongAdaptTo() {
+        try {
+            node.adaptTo(Map.class);
+        } catch(IllegalArgumentException ix) {
+            assertTrue(ix.getMessage().contains("can only adapt"));
+        }
+        
+    }
+}
diff --git a/remote-content-api/document-aggregator/src/test/java/org/apache/sling/documentaggregator/impl/MapDocumentNodeTest.java b/remote-content-api/document-aggregator/src/test/java/org/apache/sling/documentaggregator/impl/MapDocumentNodeTest.java
new file mode 100644
index 0000000..7799591
--- /dev/null
+++ b/remote-content-api/document-aggregator/src/test/java/org/apache/sling/documentaggregator/impl/MapDocumentNodeTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.documentaggregator.impl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.apache.sling.documentaggregator.api.DocumentTree;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class MapDocumentNodeTest {
+    private MapDocumentNode node;
+    
+    @BeforeEach
+    public void setup() {
+        node = new MapDocumentNode("name");
+    }
+
+    @Test
+    public void emptyNode() {
+        final Map<String, Object> m = node.adaptTo(Map.class);
+        assertEquals(0, m.size());
+    }
+
+    private static String despace(String s) {
+        return s.replaceAll(" ", "");
+    }
+
+    @Test
+    public void childLevels() {
+        node.addValue("root", "yes");
+        DocumentTree.DocumentNode child = node.addChild("one");
+        child.addValue("none", "vone");
+        child = child.addChild("two");
+        child.addValue("ntwo", "vtwo");
+        final Map<String, Object> m = node.adaptTo(Map.class);
+        assertEquals(2, m.size());
+        assertEquals("{root=yes,one={none=vone,two={ntwo=vtwo}}}", despace(m.toString()));
+    }
+
+    @Test
+    public void arrayValue() {
+        node.addChild("A").addChild("B").addValue("array", new String [] { "cat", "dog", "mouse" });
+        final String str = node.toString();
+        final Pattern pattern = Pattern.compile(".A=.B=.array=\\[Ljava.lang.String;.*.....");
+        assertTrue(pattern.matcher(str).matches(), "Expecting output '" + str + "' to match '" + pattern + "'");
+    }
+
+    @Test
+    public void wrongAdaptTo() {
+        try {
+            node.adaptTo(String.class);
+        } catch(IllegalArgumentException ix) {
+            assertTrue(ix.getMessage().contains("can only adapt"));
+        }
+        
+    }
+}