ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: The end date of an allocation is exclusive, not inclusive
This commit is contained in:
parent
6d91ef279b
commit
5753c95ded
2 changed files with 21 additions and 2 deletions
|
|
@ -463,14 +463,14 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
if (assignments.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return assignments.get(assignments.size() - 1).getDay();
|
||||
return assignments.get(assignments.size() - 1).getDay().plusDays(1);
|
||||
}
|
||||
|
||||
public boolean isAlreadyFinishedBy(LocalDate date) {
|
||||
if (getEndDate() == null) {
|
||||
return false;
|
||||
}
|
||||
return getEndDate().compareTo(date) < 0;
|
||||
return getEndDate().compareTo(date) <= 0;
|
||||
}
|
||||
|
||||
private interface PredicateOnDayAssignment {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import static org.easymock.EasyMock.expect;
|
|||
import static org.easymock.EasyMock.isA;
|
||||
import static org.easymock.classextension.EasyMock.createNiceMock;
|
||||
import static org.easymock.classextension.EasyMock.replay;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.navalplanner.business.test.planner.entities.DayAssignmentMatchers.consecutiveDays;
|
||||
|
|
@ -250,4 +251,22 @@ public class SpecificResourceAllocationTest {
|
|||
assertThat(specificResourceAllocation.getAssignments(), haveHours(2, 8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theEndDateOfTheAllocationIsExclusive() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 2);
|
||||
specificResourceAllocation.allocate(ResourcesPerDay.amount(1));
|
||||
assertThat(specificResourceAllocation.getEndDate(),
|
||||
equalTo(new LocalDate(2000, 2, 6)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theAllocationIsFinishedByEndDate() {
|
||||
LocalDate start = new LocalDate(2000, 2, 4);
|
||||
givenSpecificResourceAllocation(start, 2);
|
||||
specificResourceAllocation.allocate(ResourcesPerDay.amount(1));
|
||||
assertTrue(specificResourceAllocation
|
||||
.isAlreadyFinishedBy(specificResourceAllocation.getEndDate()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue