ProgramInstanceSupplier extends AbstractSupplier<Map<String, ProgramInstance>> { public Map<String, ProgramInstance> get( ImportOptions importOptions, Map<String, Pair<TrackedEntityInstance, Boolean>> teiMap, List<Event> events ) { if ( events == null ) { return new HashMap<>(); } Set<String> programInstanceUids = events.stream() .filter( e -> StringUtils.isNotEmpty( e.getEnrollment() ) ) .map( Event::getEnrollment ).collect( Collectors.toSet() ); Map<String, ProgramInstance> programInstances = new HashMap<>(); if ( !programInstanceUids.isEmpty() ) { Multimap<String, String> programInstanceToEvent = HashMultimap.create(); for ( Event event : events ) { programInstanceToEvent.put( event.getEnrollment(), event.getUid() ); } programInstances = getProgramInstancesByUid( importOptions, events, programInstanceToEvent, programInstanceUids ); } mapExistingEventsToProgramInstances( importOptions, events, programInstances ); mapEventsToProgramInstanceByTei( importOptions, events, programInstances, teiMap ); return programInstances; } ProgramInstanceSupplier( NamedParameterJdbcTemplate jdbcTemplate, ProgramSupplier programSupplier ); Map<String, ProgramInstance> get( ImportOptions importOptions,
        Map<String, Pair<TrackedEntityInstance, Boolean>> teiMap, List<Event> events ); @Override Map<String, ProgramInstance> get( ImportOptions importOptions, List<Event> events );  }
@Test public void handleNullEvents() { assertNotNull( subject.get( ImportOptions.getDefaultImportOptions(), new HashMap<>(), null ) ); }