### Question:
JsonWrittenEventProvider implements WrittenEventProvider<ObjectNode, JsonNode> { @Override public WrittenEvent convertEvent(ObjectNode eventData) { JsonWrittenEvent event = new JsonWrittenEvent(eventData, eventHelper); validate(event); return event; }  @Override WrittenEvent convertEvent(ObjectNode eventData); @Override TypeMarshaller<OpaqueFieldValue> getLiteralFieldValueMarshaller(); @Override OpaqueFieldValue convertFieldValue(JsonNode fieldValue); @Override OpaqueFieldValue createNilValue(); @Override LeafNodeFields createLeafNodeFields();  }### Answer:
@Test public void testConvertEvent() { ObjectNode event = mapper.createObjectNode(); eventHelper.setActivityVerb(event, EventVerb.CREATED); Id actor = new Id(idProvider.nextId()); eventHelper.setActorId(event, actor); Id centric = new Id(idProvider.nextId()); eventHelper.setUserId(event, centric); String tenant = "jive"; eventHelper.setTenantId(event, new TenantId(tenant)); String eventClass = "test"; ObjectNode instance = eventHelper.setInstanceClassName(event, eventClass); Id instanceId = new Id(idProvider.nextId()); eventHelper.setInstanceId(event, instanceId, eventClass); long snowflake = idProvider.nextId(); eventHelper.setEventId(event, snowflake); eventHelper.setTrackEventProcessedLifecycle(event, Boolean.TRUE); String value = "blah"; instance.put("value", value); ObjectId ref = new ObjectId("Foo", new Id(idProvider.nextId())); instance.put("ref", ref.toStringForm()); ArrayNode refs = mapper.createArrayNode(); ObjectId refs1 = new ObjectId("Bar", new Id(idProvider.nextId())); ObjectId refs2 = new ObjectId("Bar", new Id(idProvider.nextId())); refs.add(refs1.toStringForm()); refs.add(refs2.toStringForm()); instance.put("refs", refs); WrittenEventProvider<ObjectNode, JsonNode> provider = new JsonWrittenEventProvider(); WrittenEvent writtenEvent = provider.convertEvent(event); Assert.assertEquals(writtenEvent.getActorId(), actor); Assert.assertEquals(writtenEvent.getCentricId(), centric); Assert.assertEquals(writtenEvent.getEventId(), snowflake); Assert.assertEquals(writtenEvent.getTenantId(), new TenantId(tenant)); WrittenInstance payload = writtenEvent.getWrittenInstance(); Assert.assertEquals(payload.getInstanceId(), new ObjectId(eventClass, instanceId)); Assert.assertTrue(payload.hasField("value")); Assert.assertTrue(payload.hasField("ref")); Assert.assertTrue(payload.hasField("refs")); JsonNode valueAsJson = mapper.convertValue(value, JsonNode.class); JsonNode refAsJson = mapper.convertValue(ref.toStringForm(), JsonNode.class); Assert.assertEquals(payload.getFieldValue("value"), provider.convertFieldValue(valueAsJson)); Assert.assertEquals(payload.getFieldValue("ref"), provider.convertFieldValue(refAsJson)); Assert.assertEquals(payload.getFieldValue("refs"), provider.convertFieldValue(refs)); }