[Bug #1091] Be more lenient if the end date is before start date
Do nothing instead of throwing an exception.
This commit is contained in:
parent
e2a4fff81c
commit
834dbeb39b
2 changed files with 7 additions and 3 deletions
|
|
@ -771,7 +771,8 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
private AllocateResourcesPerDayOnInterval(
|
||||
IntraDayDate startInclusive, IntraDayDate endExclusive) {
|
||||
this.startInclusive = startInclusive;
|
||||
this.endExclusive = endExclusive;
|
||||
this.endExclusive = IntraDayDate.max(startInclusive,
|
||||
endExclusive);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -456,8 +456,8 @@ public class GenericResourceAllocationTest {
|
|||
assertThat(orderedAssignmentsFor, haveHours(hoursPerDay, hoursPerDay));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void whenAllocatingUntilSomeEndDateTheEndDateMustNotBeBeforeTaskStart() {
|
||||
@Test
|
||||
public void whenAllocatingUntilSomeEndDateBeforeTheStartNothingIsDone() {
|
||||
LocalDate start = new LocalDate(2006, 10, 5);
|
||||
givenTaskWithStartAndEnd(toInterval(start, Period.days(4)));
|
||||
givenGenericResourceAllocationForTask(task);
|
||||
|
|
@ -467,6 +467,9 @@ public class GenericResourceAllocationTest {
|
|||
genericResourceAllocation.forResources(Arrays.asList(worker1))
|
||||
.resourcesPerDayUntil(start.minusDays(1))
|
||||
.allocate(resourcesPerDay);
|
||||
|
||||
assertTrue(genericResourceAllocation.getOrderedAssignmentsFor(worker1)
|
||||
.isEmpty());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue