@Test
public void failWhenEventHasDateBeforeCurrentDateAndProgramExpiryDaysBasedOnPeriod()
{

    // Given
    final String monthlyPeriodType = new SimpleDateFormat( "yyyyMM" ).format( new Date() );
    // Prepare program
    Program program = createProgram( 'P' );
    program.setExpiryPeriodType( PeriodType.getPeriodTypeFromIsoString( monthlyPeriodType ) );
    program.setExpiryDays( 3 );
    Map<String, Program> programMap = new HashMap<>();
    programMap.put( program.getUid(), program );
    when( workContext.getProgramsMap() ).thenReturn( programMap );
    // Prepare event
    event.setProgram( program.getUid() );
    event.setEventDate( new SimpleDateFormat( "yyyy-MM-dd" ).format( getTodayMinusDays( 100 ) ) );
    // When
    ImportSummary importSummary = rule.check( new ImmutableEvent( event ), workContext );
    // Then
    assertHasError( importSummary, event,
        "The event's date belongs to an expired period. It is not possible to create such event" );
}