Examples of asDurationGivenWorkingDayOf()


Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

            @Override
            public EffortDuration answer() throws Throwable {
                ResourcesPerDay perDay = (ResourcesPerDay) EasyMock
                        .getCurrentArguments()[1];
                return perDay.asDurationGivenWorkingDayOf(duration);
            }
        };
    }

    private void givenResourceCalendar(final Capacity defaultAnswer,
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

                Capacity capacity = answersForDates.containsKey(date) ? answersForDates
                        .get(date) : defaultAnswer;

                EffortDuration oneResourcePerDayWorkingDuration = day
                        .limitWorkingDay(capacity.getStandardEffort());
                EffortDuration amountRequestedDuration = resourcesPerDay
                        .asDurationGivenWorkingDayOf(oneResourcePerDayWorkingDuration);
                return capacity.limitDuration(amountRequestedDuration);
            }
        };
        expect(
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

                    @Override
                    public EffortDuration answer() throws Throwable {
                        PartialDay day = (PartialDay) getCurrentArguments()[0];
                        ResourcesPerDay resourcesPerDay = (ResourcesPerDay) getCurrentArguments()[1];
                        if (availability.isValid(day.getDate())) {
                            return day.limitWorkingDay(resourcesPerDay
                                    .asDurationGivenWorkingDayOf(workingDay));
                        } else {
                            return zero();
                        }
                    }
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

    @Test
    public void canBeConvertedToDurationsGivenTheWorkingDayInDifferentGranularities() {
        ResourcesPerDay units = ResourcesPerDay.amount(2);
        for (Granularity each : Granularity.values()) {
            assertThat(units.asDurationGivenWorkingDayOf(EffortDuration
                    .elapsing(8, each)), equalTo(EffortDuration.elapsing(16,
                    each)));
        }
    }
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

    @Test
    public void ifTheAmountIsDecimalTheSecondsAreMultiplied() {
        ResourcesPerDay resourcesPerDay = ResourcesPerDay
                .amount(new BigDecimal(2.4));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(8)),
                equalTo(hours(19).and(12, Granularity.MINUTES)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(10)),
                equalTo(hours(24)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(2)),
                equalTo(hours(4).and(48, Granularity.MINUTES)));
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

    public void ifTheAmountIsDecimalTheSecondsAreMultiplied() {
        ResourcesPerDay resourcesPerDay = ResourcesPerDay
                .amount(new BigDecimal(2.4));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(8)),
                equalTo(hours(19).and(12, Granularity.MINUTES)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(10)),
                equalTo(hours(24)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(2)),
                equalTo(hours(4).and(48, Granularity.MINUTES)));
    }
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

                .amount(new BigDecimal(2.4));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(8)),
                equalTo(hours(19).and(12, Granularity.MINUTES)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(10)),
                equalTo(hours(24)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(hours(2)),
                equalTo(hours(4).and(48, Granularity.MINUTES)));
    }

    @Test
    public void theSecondsAreRoundedHalfUpUnlessItIsMinusThanOneSecond() {
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

    @Test
    public void theSecondsAreRoundedHalfUpUnlessItIsMinusThanOneSecond() {
        ResourcesPerDay resourcesPerDay = ResourcesPerDay
                .amount(new BigDecimal(2.4));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(seconds(1)),
                equalTo(seconds(2)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(seconds(2)),
                equalTo(seconds(5)));
    }
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

    public void theSecondsAreRoundedHalfUpUnlessItIsMinusThanOneSecond() {
        ResourcesPerDay resourcesPerDay = ResourcesPerDay
                .amount(new BigDecimal(2.4));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(seconds(1)),
                equalTo(seconds(2)));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(seconds(2)),
                equalTo(seconds(5)));
    }

    @Test
    public void asSecondsMustReturnOneIfResultingAmountFromMultiplicationIsGreaterThanZero() {
View Full Code Here

Examples of org.libreplan.business.workingday.ResourcesPerDay.asDurationGivenWorkingDayOf()

    @Test
    public void asSecondsMustReturnOneIfResultingAmountFromMultiplicationIsGreaterThanZero() {
        ResourcesPerDay resourcesPerDay = ResourcesPerDay
                .amount(new BigDecimal(0.1));
        assertThat(resourcesPerDay.asDurationGivenWorkingDayOf(seconds(1)),
                equalTo(seconds(1)));
    }

    @Test
    public void twoResourcesPerDayAreEqualsIfNormalizeToTheSameAmount() {
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.