Package org.libreplan.business.planner.entities.StretchesFunction

Examples of org.libreplan.business.planner.entities.StretchesFunction.Interval


        LocalDate strechDate = new LocalDate().plusDays(1);
        BigDecimal amountOfWorkProportion = BigDecimal.valueOf(0.5).setScale(2);
        givenStretchAsChild(strechDate, amountOfWorkProportion);
        givenStretchAsChild(new LocalDate().plusDays(2),
                BigDecimal.valueOf(1.0));
        Interval firstInterval = stretchesFunction
                .getIntervalsDefinedByStreches().get(1);
        assertThat(firstInterval.getEnd(), equalTo(strechDate));
        assertFalse(firstInterval.hasNoStart());
        assertThat(firstInterval.getLoadProportion(),
                equalTo(amountOfWorkProportion));
    }
View Full Code Here


    public void theLastIntervalHasStart() {
        givenStretchesFunction();
        LocalDate strechDate = new LocalDate().plusDays(1);
        givenStretchAsChild(strechDate, new BigDecimal(0.5));
        givenStretchAsChild(strechDate.plusDays(2), new BigDecimal(1));
        Interval lastInterval = stretchesFunction
                .getIntervalsDefinedByStreches().get(2);
        assertThat(lastInterval.getStart(), equalTo(strechDate));
    }
View Full Code Here

        LocalDate start = new LocalDate().plusDays(1);
        givenStretchAsChild(start, new BigDecimal(0.5));
        LocalDate middleEnd = start.plusDays(2);
        givenStretchAsChild(middleEnd, new BigDecimal(0.6));
        givenStretchAsChild(middleEnd.plusDays(3), new BigDecimal(1));
        Interval middle = stretchesFunction.getIntervalsDefinedByStreches()
                .get(2);
        assertFalse(middle.hasNoStart());
        assertThat(middle.getStart(), equalTo(start));
        assertThat(middle.getEnd(), equalTo(middleEnd));
    }
View Full Code Here

        LocalDate start = new LocalDate().plusDays(1);
        givenStretchAsChild(start, new BigDecimal(0.5));
        LocalDate middleEnd = start.plusDays(2);
        givenStretchAsChild(middleEnd, new BigDecimal(0.8));
        givenStretchAsChild(middleEnd.plusDays(3), new BigDecimal(1));
        Interval first = stretchesFunction.getIntervalsDefinedByStreches().get(
                1);
        Interval middle = stretchesFunction.getIntervalsDefinedByStreches()
                .get(2);
        Interval last = stretchesFunction.getIntervalsDefinedByStreches()
                .get(3);
        assertThat(first.getLoadProportion(), equalTo(new BigDecimal(0.5)
                .setScale(2)));
        assertThat(middle.getLoadProportion(), equalTo(new BigDecimal(0.3)
                .setScale(2, RoundingMode.HALF_EVEN)));
        assertThat(last.getLoadProportion(), equalTo(new BigDecimal(0.2)
                .setScale(2, RoundingMode.HALF_EVEN)));
    }
View Full Code Here

    }

    @Test
    public void ifTheIntervalStartIsNullReturnsThePassedStartDate() {
        LocalDate end = new LocalDate().plusMonths(1);
        Interval interval = new Interval(new BigDecimal(0.3), null, end);
        LocalDate now = new LocalDate();
        assertThat(interval.getStartFor(now), equalTo(now));
    }
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void endDateCannotBeNull() {
        LocalDate start = new LocalDate().plusMonths(1);
        new Interval(new BigDecimal(0.3), start, null);
    }
View Full Code Here

    }

    @Test
    public void ifTheIntervalStartIsNotNullReturnsItsStartDate() {
        LocalDate start = new LocalDate().plusMonths(1);
        Interval interval = new Interval(new BigDecimal(0.3), start, start
                .plusDays(20));
        assertThat(interval.getStartFor(new LocalDate()), equalTo(start));
    }
View Full Code Here

    @Test
    public void ifTheIntervalEndIsNotNullReturnsItsEndDate() {
        LocalDate start = new LocalDate().plusMonths(1);
        LocalDate end = new LocalDate().plusMonths(2);
        Interval interval = new Interval(new BigDecimal(0.3), start, end);
        assertThat(interval.getEnd(), equalTo(end));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.entities.StretchesFunction.Interval

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.