### Question:
JsonFieldWriter implements AtlasFieldWriter { public ContainerNode<?> getRootNode() { return rootNode; } JsonFieldWriter();  JsonFieldWriter(ObjectMapper objectMapper); ContainerNode<?> getRootNode(); ObjectMapper getObjectMapper(); @Override void write(AtlasInternalSession session);  }### Answer:
@Test public void testSimpleRepeated() throws Exception { writeString("/orders[0]/orderid", "orderid1"); writeString("/orders[1]/orderid", "orderid2"); Assert.assertThat(writer.getRootNode().toString(), Is.is("{\"orders\":[{\"orderid\":\"orderid1\"},{\"orderid\":\"orderid2\"}]}")); }
@Test public void testWriteComplexObjectUnrooted() throws Exception { writeComplexTestData("", ""); Assert.assertThat(writer.getRootNode().toString(), Is.is( "{\"address\":{\"addressLine1\":\"123 Main St\",\"addressLine2\":\"Suite 42b\",\"city\":\"Anytown\",\"state\":\"NY\",\"zipCode\":\"90210\"},\"contact\":{\"firstName\":\"Ozzie\",\"lastName\":\"Smith\",\"phoneNumber\":\"5551212\",\"zipCode\":\"81111\"},\"orderId\":9}")); }
@Test public void testWriteComplexObjectRooted() throws Exception { writeComplexTestData("/order", ""); final String instance = new String( Files.readAllBytes(Paths.get("src/test/resources/complex-rooted-result.json"))); Assert.assertNotNull(instance); Assert.assertThat(prettyPrintJson(writer.getRootNode().toString()), Is.is(prettyPrintJson(instance))); }
@Test public void testWriteComplexObjectRepeated() throws Exception { for (int i = 0; i < 5; i++) { String prefix = "/SourceOrderList/orders[" + i + "]"; String valueSuffix = " (" + (i + 1) + ")"; writeComplexTestData(prefix, valueSuffix); } writeInteger("/SourceOrderList/orderBatchNumber", 4123562); writeInteger("/SourceOrderList/numberOfOrders", 5); final String instance = new String( Files.readAllBytes(Paths.get("src/test/resources/complex-repeated-result.json"))); Assert.assertNotNull(instance); Assert.assertThat(prettyPrintJson(writer.getRootNode().toString()), Is.is(prettyPrintJson(instance))); }