EventTrackerConverterService implements TrackerConverterService<Event, ProgramStageInstance> { @Override public ProgramStageInstance from( TrackerPreheat preheat, Event event ) { ProgramStageInstance programStageInstance = preheat.getEvent( TrackerIdScheme.UID, event.getEvent() ); return from( preheat, event, programStageInstance ); } EventTrackerConverterService( NotesConverterService notesConverterService ); @Override Event to( ProgramStageInstance programStageInstance ); @Override List<Event> to( List<ProgramStageInstance> programStageInstances ); @Override ProgramStageInstance from( TrackerPreheat preheat, Event event ); @Override List<ProgramStageInstance> from( TrackerPreheat preheat, List<Event> events ); @Override ProgramStageInstance fromForRuleEngine( TrackerPreheat preheat, Event event );  }
@Test public void testToProgramStageInstance() { Event event = new Event(); event.setProgram( PROGRAM_UID ); event.setProgramStage( PROGRAM_STAGE_UID ); event.setOrgUnit( ORGANISATION_UNIT_UID ); ProgramStageInstance programStageInstance = trackerConverterService.from( preheat, event ); assertNotNull( programStageInstance ); assertNotNull( programStageInstance.getProgramStage() ); assertNotNull( programStageInstance.getProgramStage().getProgram() ); assertNotNull( programStageInstance.getOrganisationUnit() ); assertEquals( PROGRAM_UID, programStageInstance.getProgramStage().getProgram().getUid() ); assertEquals( PROGRAM_STAGE_UID, programStageInstance.getProgramStage().getUid() ); assertEquals( ORGANISATION_UNIT_UID, programStageInstance.getOrganisationUnit().getUid() ); }