Package org.libreplan.business.calendars.entities

Examples of org.libreplan.business.calendars.entities.BaseCalendar.asDurationOn()


    @Test
    public void asDurationOnRespectsANotOverAssignableCalendarException() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(1))
                .notOverAssignableWithoutLimit());
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(1)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(1)));
View Full Code Here


        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(1))
                .notOverAssignableWithoutLimit());
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(1)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(1)));
    }

    @Test
View Full Code Here

    @Test
    public void asDurationOnRespectsCapacityExtraEffort() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(2))
                .withAllowedExtraEffort(hours(3)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(2)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(4)));
View Full Code Here

        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(2))
                .withAllowedExtraEffort(hours(3)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(2)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(4)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(3)), equalTo(hours(5)));
View Full Code Here

                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(2)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(4)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(3)), equalTo(hours(5)));
    }

    @Test
View Full Code Here

                            return zero();
                        }
                    }
                }).anyTimes();
        expect(
                result.asDurationOn(isA(PartialDay.class),
                        isA(ResourcesPerDay.class))).andAnswer(
                new IAnswer<EffortDuration>() {

                    @Override
                    public EffortDuration answer() throws Throwable {
View Full Code Here

                        .asDurationGivenWorkingDayOf(day.limitWorkingDay(capacity
                                .getStandardEffort())));
            }
        };
        expect(
                baseCalendar.asDurationOn(isA(PartialDay.class),
                        isA(ResourcesPerDay.class))).andAnswer(durationAnswer)
                .anyTimes();
        expect(baseCalendar.getCapacityWithOvertime(isA(LocalDate.class)))
                .andReturn(capacityMultipliedByUnits).anyTimes();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.