### Question:
ElasticsearchTypeUtils { private Extractor makeVarCharExtractor(Field field) { return (VarCharExtractor) (Object context, NullableVarCharHolder dst) -> { Object fieldValue = ((Map) context).get(field.getName()); dst.isSet = 1; if (fieldValue instanceof String) { dst.value = (String) fieldValue; } else if (fieldValue instanceof List) { Object value = ((List) fieldValue).get(0); if (value instanceof String) { dst.value = (String) value; } else { dst.isSet = 0; } } else { dst.isSet = 0; } }; } protected  ElasticsearchTypeUtils();   }### Answer:
@Test public void makeVarCharExtractorTest() throws Exception { logger.info("makeVarCharExtractorTest - enter"); mapping = SchemaBuilder.newBuilder() .addField("mytext", Types.MinorType.VARCHAR.getType()) .addField("mytextlist", Types.MinorType.VARCHAR.getType()) .build(); Map <String, Object> document = new ObjectMapper().readValue( "{\n" + " \"mytext\" : \"My favorite Sci-Fi movie is Interstellar.\",\n" + " \"mytextlist\" : [\n" + " \"Hey, this is an array!\",\n" + " \"Wasn't expecting this!\"\n" + " ]\n" + "}\n", HashMap.class); Map<String, Object> expectedResults = ImmutableMap.of( "mytext", "My favorite Sci-Fi movie is Interstellar.", "mytextlist", "Hey, this is an array!"); Map<String, Object> extractedResults = testField(mapping, document); logger.info("makeVarCharExtractorTest - Expected: {}, Extracted: {}", expectedResults, extractedResults); assertEquals("Extracted results are not as expected!", expectedResults, extractedResults); logger.info("makeVarCharExtractorTest - exit"); }