ItEr23S08CUEdicionCalendarioLaboral: Added specific test to check that exceptions are associated with the valid calendar in that moment.

This commit is contained in:
Manuel Rego Casasnovas 2009-08-27 14:14:15 +02:00 committed by Óscar González Fernández
parent 2019046855
commit 0be1d61529

View file

@ -566,4 +566,26 @@ public class BaseCalendarTest {
equalTo(fridayHours));
}
@Test
public void testExceptionsInDifferentVersions() {
BaseCalendar calendar = createBasicCalendar();
BaseCalendar newVersion = calendar.newVersion(WEDNESDAY_LOCAL_DATE);
newVersion.addExceptionDay(ExceptionDay.create(MONDAY_LOCAL_DATE, 0));
newVersion.addExceptionDay(ExceptionDay.create(FRIDAY_LOCAL_DATE, 0));
Integer mondayHours = newVersion.getWorkableHours(MONDAY_LOCAL_DATE);
assertThat(mondayHours, equalTo(0));
assertThat(calendar.getWorkableHours(MONDAY_LOCAL_DATE),
equalTo(mondayHours));
Integer fridayHours = newVersion.getWorkableHours(FRIDAY_LOCAL_DATE);
assertThat(fridayHours, equalTo(0));
assertThat(calendar.getWorkableHours(FRIDAY_LOCAL_DATE),
equalTo(fridayHours));
assertThat(calendar.getOwnExceptions().size(), equalTo(1));
assertThat(newVersion.getOwnExceptions().size(), equalTo(1));
}
}