@Test
public void verifyEnrollmentIsSetOnEventWhenOneProgramInstanceIsFound()
{

    //
    // Tracked Entity Instance
    //
    TrackedEntityInstance tei = createTrackedEntityInstance( createOrganisationUnit( 'A' ) );
    when( workContext.getTrackedEntityInstance( event.getUid() ) ).thenReturn( Optional.of( tei ) );
    ProgramInstance programInstance = new ProgramInstance();
    programInstance.setUid( CodeGenerator.generateUid() );
    when( programInstanceStore.get( tei, program, ProgramStatus.ACTIVE ) )
        .thenReturn( Lists.newArrayList( programInstance ) );
    event.setProgram( program.getUid() );
    //
    // Method under test
    //
    subject.process( event, workContext );
    assertThat( event.getEnrollment(), is( programInstance.getUid() ) );
    assertThat( programInstanceMap.get( event.getUid() ), is( programInstance ) );
}