### Question:
CSVUtil { static CellProcessorAdaptor decideAdaptor(Field field) { String fieldType = field.getType().getSimpleName().toUpperCase(Locale.ENGLISH); if(field.getType().getGenericSuperclass() != null) { if (field.getType().getGenericSuperclass().toString().startsWith("java.lang.Enum")) { fieldType = "ENUM"; return Parsers.valueOf(fieldType).getParser(field.getType()); } } if(fieldType.equals("DATE")){ if(field.getAnnotation(JsonFormat.class) != null){ String format = field.getAnnotation(JsonFormat.class).pattern(); return new ParseDate(format); }else{ throw new RuntimeException("Date type must have SimpleDateFormat annotation with a valid format."); } }else{ return Parsers.valueOf(fieldType).getParser(); } }    }### Answer:
@Test public void decideAdaptor() throws Exception { Field[] fields = SamplePojo.class.getFields(); for (int i = 0; i < fields.length; i++) { CellProcessorAdaptor adapter = CSVUtil.decideAdaptor(fields[i]); if (!fields[i].getType().getTypeName().equals(String.class.getName())) { assertNotNull(adapter); } } }
@Test(expected = RuntimeException.class) public void decideAdaptorDateError() throws Exception { Field field = getClass().getField("failDate"); CellProcessorAdaptor adapter = CSVUtil.decideAdaptor(field); assertNotNull(adapter); }