### Question:
CSVUtil { static CellProcessor[] convertFieldsToCellProcessors(Collection<Converter.FieldEntry> fields, String[] fieldNames) { CellProcessor[] processors = new CellProcessor[fields.size()]; int i = 0; for (Converter.FieldEntry fieldEntry : fields) { Field field = fieldEntry.getValue(); Convert an = field.getAnnotation(Convert.class); CellProcessorAdaptor a = decideAdaptor(field); CellProcessor p; if (an.optional()) { if (a != null) { p = new Optional(a); } else { p = new Optional(); } } else { if (a != null) { p = new NotNull(a); } else { p = new NotNull(); } } fieldNames[i] = field.getName(); processors[i++] = p; } return processors; }    }### Answer:
@Test public void convertFieldsToCellProcessors() throws Exception { Collection<Converter.FieldEntry> entries = new LinkedList<>(); Field[] fields = SamplePojo.class.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { Convert convert = fields[i].getDeclaredAnnotation(Convert.class); if (convert != null && !convert.ignore()) { entries.add(new Converter.FieldEntry(i, fields[i])); } } String[] fieldNames = new String[entries.size()]; CellProcessor[] processors = CSVUtil.convertFieldsToCellProcessors(entries, fieldNames); assertEquals(10, fieldNames.length); assertEquals(10, processors.length); }