### Question:
TranslatorFromJson { public void translate(JsonDoc document, T target){ Error.push("translating from json"); try{ JsonNodeCursor cursor = document.cursor(); if (!cursor.firstChild()) { return; } do { translate(cursor, target); } while (cursor.nextSibling()); } finally{ Error.pop(); } } TranslatorFromJson(EntityMetadata entityMetadata); void translate(JsonDoc document, T target);  }### Answer:
@Test public void testTranslateSimpleArrayField() throws Exception { EntityMetadata md = fakeEntityMetadata("fakeMetadata", new ArrayField("array", new SimpleArrayElement(StringType.TYPE))); FakeTranslatorFromJson<SingleFieldObject<String[]>> translator = new FakeTranslatorFromJson<SingleFieldObject<String[]>>(md) { @SuppressWarnings("unchecked") @Override protected void translate(ArrayField field, List<Object> items, Object target) { if (target instanceof SingleFieldObject) { List<String> translatedItems = new ArrayList<>(); items.forEach(item -> translatedItems.add(item.toString())); ((SingleFieldObject<String[]>) target).value = translatedItems.toArray(new String[0]); } else { throw new RuntimeException("Unexpected"); } } }; SingleFieldObject<String[]> response = new SingleFieldObject<>(); translator.translate(new JsonDoc(json("{\"array\":[\"hello\",\"world\"]}")), response); assertNotNull(response); assertEquals(2, response.value.length); assertEquals("hello", response.value[0]); assertEquals("world", response.value[1]); }