Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.IntraDayDate


                .allocateHours(0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void cantAllocateNegativeHours() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(start,
                plusDays(start, 1))
                .allocateHours(-1);
    }
View Full Code Here


                .allocateHours(-1);
    }

    @Test
    public void someHoursInAnIntervalCanBeAssigned() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(start,
                plusDays(start, 2))
                .allocateHours(10);
        assertThat(specificResourceAllocation.getAssignments(), haveHours(5, 5));
View Full Code Here

        assertThat(specificResourceAllocation.getAssignments(), haveHours(5, 5));
    }

    @Test
    public void theHoursForEachDayCanBeAssigned() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(start,
                plusDays(start, 4)).allocate(
                Arrays.asList(hours(4), hours(8), hours(4), hours(8)));
        assertThat(specificResourceAllocation.getAssignments(),
View Full Code Here

                haveHours(4, 8, 4, 8));
    }

    @Test
    public void ifLessDaysAreSpecifiedTheInitialDaysAreAllocated() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(start,
                plusDays(start, 4)).allocate(
                Arrays.asList(hours(4), hours(8), hours(4)));
        assertThat(specificResourceAllocation.getAssignments(),
View Full Code Here

                haveHours(4, 8, 4));
    }

    @Test
    public void ifMoreDaysAreSpecifiedTheInitialDaysAreAllocated() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(start,
                plusDays(start, 4))
                .allocate(
                        Arrays.asList(hours(4), hours(8), hours(4), hours(4),
View Full Code Here

                haveHours(4, 8, 4, 4));
    }

    @Test
    public void theDaysSpecifiedOutsideBoundsAreDiscarded() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(minusDays(start, 2),
                plusDays(start, 1)).allocate(
                Arrays.asList(hours(2), hours(3), hours(4)));
        assertThat(specificResourceAllocation.getAssignments(), haveHours(4));
View Full Code Here

        assertThat(specificResourceAllocation.getAssignments(), haveHours(4));
    }

    @Test
    public void combineOutsideBoundsAndZeroPadding() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(minusDays(start, 2),
                plusDays(start, 1)).allocate(Arrays.asList(hours(2), hours(3)));
        assertThat(specificResourceAllocation.getAssignments(), haveHours());
    }
View Full Code Here

        assertThat(specificResourceAllocation.getAssignments(), haveHours());
    }

    @Test
    public void theDaysSpecifiedOutsideTheTaskAreDiscarded() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(minusDays(start, 1),
                plusDays(start, 4)).allocate(
                Arrays.asList(hours(10), hours(4), hours(8), hours(4),
                        hours(4), hours(3)));
View Full Code Here

        assertThat(assigments, haveHours(4, 8, 4, 4));
    }

    @Test
    public void theIntervalWithinTaskCanBeMadeOfIntraDayDates() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        IntraDayDate startInterval = start;
        IntraDayDate endInterval = plusDaysAndEffort(start, 2,
                EffortDuration.hours(4));
        specificResourceAllocation.onIntervalWithinTask(startInterval,
                endInterval).allocateHours(12);
        List<SpecificDayAssignment> assignments = specificResourceAllocation
                .getAssignments();
View Full Code Here

                .compareTo(assignments.get(2).getDuration()) > 0);
    }

    @Test
    public void thePartOfTheIntervalUsedIsTheOneOverlapping() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.onIntervalWithinTask(plusDays(start, 1),
                plusDays(start, 6)).allocateHours(12);
        assertThat(specificResourceAllocation.getAssignments(),
                haveHours(4, 4, 4));
View Full Code Here

TOP

Related Classes of org.libreplan.business.workingday.IntraDayDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.