@Test
public void shouldWriteDocumentWithNestedDocument() throws Exception {

    doc.set("field1", "value");
    doc.set("field2", 22);
    doc.set("field3", Document.create("a", "A", "b", "B"));
    after = reader.read(writer.write(doc));
    Testing.print(after);
    assertThat(after.getString("field1")).isEqualTo("value");
    assertThat(after.getInteger("field2")).isEqualTo(22);
    assertThat(after.size()).isEqualTo(3);
    Document nested = after.getDocument("field3");
    assertThat(nested.getString("a")).isEqualTo("A");
    assertThat(nested.getString("b")).isEqualTo("B");
    assertThat(nested.size()).isEqualTo(2);
}