CategoryOptionComboSupplier extends AbstractSupplier<Map<String, CategoryOptionCombo>> { @Override public Map<String, CategoryOptionCombo> get( ImportOptions importOptions, List<Event> events ) { if ( events == null ) { return emptyMap(); } IdScheme idScheme = importOptions.getIdSchemes().getCategoryOptionIdScheme(); Map<String, CategoryOptionCombo> eventToCocMap = new HashMap<>(); Map<String, Program> programMap = programSupplier.get( importOptions, events ); for ( Event event : events ) { Program program = programMap.get( event.getProgram() ); if ( program == null ) { return emptyMap(); } final CategoryCombo programCatCombo = program.getCategoryCombo(); final String aoc = event.getAttributeOptionCombo(); final String attributeCatOptions = event.getAttributeCategoryOptions(); CategoryOptionCombo categoryOptionCombo; if ( isNotEmpty( aoc ) ) { categoryOptionCombo = attributeOptionComboLoader.getCategoryOptionCombo( idScheme, aoc ); if ( categoryOptionCombo == null ) { categoryOptionCombo = attributeOptionComboLoader.getDefault(); } } else if ( programCatCombo != null && isNotEmpty( attributeCatOptions ) ) { categoryOptionCombo = attributeOptionComboLoader.getAttributeOptionCombo( programCatCombo, attributeCatOptions, aoc, idScheme ); } else { categoryOptionCombo = attributeOptionComboLoader.getDefault(); } if ( categoryOptionCombo != null ) { eventToCocMap.put( event.getUid(), categoryOptionCombo ); } } return eventToCocMap; } CategoryOptionComboSupplier( NamedParameterJdbcTemplate jdbcTemplate, ProgramSupplier programSupplier,
        AttributeOptionComboLoader attributeOptionComboLoader ); @Override Map<String, CategoryOptionCombo> get( ImportOptions importOptions, List<Event> events );  }
@Test public void handleNullEvents() { assertNotNull( subject.get( ImportOptions.getDefaultImportOptions(), null ) ); }