### Question:
ElasticsearchTypeUtils { private Extractor makeSmallIntExtractor(Field field) { return (SmallIntExtractor) (Object context, NullableSmallIntHolder dst) -> { Object fieldValue = ((Map) context).get(field.getName()); dst.isSet = 1; if (fieldValue instanceof Number) { dst.value = ((Number) fieldValue).shortValue(); } else if (fieldValue instanceof String) { dst.value = new Double((String) fieldValue).shortValue(); } else if (fieldValue instanceof List) { Object value = ((List) fieldValue).get(0); if (value instanceof Number) { dst.value = ((Number) value).shortValue(); } else if (value instanceof String) { dst.value = new Double((String) value).shortValue(); } else { dst.isSet = 0; } } else { dst.isSet = 0; } }; } protected  ElasticsearchTypeUtils();   }### Answer:
@Test public void makeSmallIntExtractorTest() throws Exception { logger.info("makeSmallIntExtractorTest - enter"); mapping = SchemaBuilder.newBuilder() .addField("myshort", Types.MinorType.SMALLINT.getType()) .addField("myshortstring", Types.MinorType.SMALLINT.getType()) .addField("myshortlist", Types.MinorType.SMALLINT.getType()) .addField("myshortstringlist", Types.MinorType.SMALLINT.getType()) .build(); Map <String, Object> document = new ObjectMapper().readValue( "{\n" + " \"myshort\" : 123.5,\n" + " \"myshortstring\" : \"055.55\",\n" + " \"myshortlist\" : [\n" + " 543.342,\n" + " 1000304594\n" + " ],\n" + " \"myshortstringlist\" : [\n" + " \"334.33\",\n" + " \"33433535\"\n" + " ]\n" + "}\n", HashMap.class); Map<String, Object> expectedResults = ImmutableMap.of( "myshort", new Short((short)123), "myshortstring", new Short((short)55), "myshortlist", new Short((short) 543), "myshortstringlist", new Short((short) 334)); Map<String, Object> extractedResults = testField(mapping, document); logger.info("makeSmallIntExtractorTest - Expected: {}, Extracted: {}", expectedResults, extractedResults); assertEquals("Extracted results are not as expected!", expectedResults, extractedResults); logger.info("makeSmallIntExtractorTest - exit"); }