@Test public void shouldIgnoreNonAnnotatedHeaders() throws UploadException { List<String> headers = new ArrayList<String>(); headers.add("mandatory string field"); headers.add("mandatoryIntField"); headers.add("nonAnnotatedField"); headers.add("random"); List<CellProcessor> cellProcessors = CsvCellProcessors.getProcessors(dummyImportableClass, headers); assertEquals(4, cellProcessors.size()); assertTrue(cellProcessors.get(0) instanceof NotNull); assertTrue(cellProcessors.get(1) instanceof NotNull); assertNull(cellProcessors.get(2)); assertNull(cellProcessors.get(3)); }
public static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers) { List<CellProcessor> processors = new ArrayList<>(); for (String header : headers) { org.openlmis.upload.model.Field field = modelClass.findImportFieldWithName(header); CellProcessor processor = null; if (field != null) { processor = chainTypeProcessor(field); } processors.add(processor); } return processors; }
CsvCellProcessors { public static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers) { List<CellProcessor> processors = new ArrayList<>(); for (String header : headers) { org.openlmis.upload.model.Field field = modelClass.findImportFieldWithName(header); CellProcessor processor = null; if (field != null) { processor = chainTypeProcessor(field); } processors.add(processor); } return processors; } }
CsvCellProcessors { public static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers) { List<CellProcessor> processors = new ArrayList<>(); for (String header : headers) { org.openlmis.upload.model.Field field = modelClass.findImportFieldWithName(header); CellProcessor processor = null; if (field != null) { processor = chainTypeProcessor(field); } processors.add(processor); } return processors; }  }
CsvCellProcessors { public static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers) { List<CellProcessor> processors = new ArrayList<>(); for (String header : headers) { org.openlmis.upload.model.Field field = modelClass.findImportFieldWithName(header); CellProcessor processor = null; if (field != null) { processor = chainTypeProcessor(field); } processors.add(processor); } return processors; }  static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers); }
CsvCellProcessors { public static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers) { List<CellProcessor> processors = new ArrayList<>(); for (String header : headers) { org.openlmis.upload.model.Field field = modelClass.findImportFieldWithName(header); CellProcessor processor = null; if (field != null) { processor = chainTypeProcessor(field); } processors.add(processor); } return processors; }  static List<CellProcessor> getProcessors(ModelClass modelClass, List<String> headers); static Map<String, CellProcessor> typeMappings; }