@Test
public void verifyErrorOnEventWithDateNewerThanCompletedProgramInstance()
{

    // Given
    ImportOptions importOptions = ImportOptions.getDefaultImportOptions();
    importOptions.setUser( new User() );
    event.setEvent( event.getUid() );
    Map<String, ProgramInstance> programInstanceMap = new HashMap<>();
    ProgramInstance programInstance = new ProgramInstance();
    programInstance.setStatus( ProgramStatus.COMPLETED );
    // Set program instance end date to NOW - one month
    programInstance.setEndDate( Date.from( ZonedDateTime.now().minusMonths( 1 ).toInstant() ) );
    programInstanceMap.put( event.getUid(), programInstance );
    when( workContext.getProgramInstanceMap() ).thenReturn( programInstanceMap );
    when( workContext.getImportOptions() ).thenReturn( importOptions );
    // When
    ImportSummary importSummary = rule.check( new ImmutableEvent( event ), workContext );
    // Then
    assertHasError( importSummary, event, null );
}