Package org.libreplan.business.calendars.entities

Examples of org.libreplan.business.calendars.entities.Capacity


    public static BaseCalendar createBasicCalendar() {
        BaseCalendar calendar = BaseCalendar.create();

        calendar.setName("test-" + UUID.randomUUID());

        Capacity eightHours = withNormalDuration(hours(8));
        calendar.setCapacityAt(Days.MONDAY, eightHours);
        calendar.setCapacityAt(Days.TUESDAY, eightHours);
        calendar.setCapacityAt(Days.WEDNESDAY, eightHours);
        calendar.setCapacityAt(Days.THURSDAY, eightHours);
        calendar.setCapacityAt(Days.FRIDAY, eightHours);
View Full Code Here


        assertThat(calendar.getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE)),
                equalTo(zero()));
    }

    public static void setHoursForAllDays(BaseCalendar calendar, Integer hours) {
        Capacity capacity = withNormalDuration(hours(hours));
        for (Days each : Days.values()) {
            calendar.setCapacityAt(each, capacity);
        }
    }
View Full Code Here

    }

    @Test
    public void getCapacityWithOvertimeOnReturnsTheCapacityForThatDay() {
        BaseCalendar calendar = createBasicCalendar();
        Capacity capacitySet = Capacity.create(hours(8))
                .overAssignableWithoutLimit();

        calendar.setCapacityAt(Days.MONDAY, capacitySet);
        assertThat(calendar.getCapacityWithOvertime(MONDAY_LOCAL_DATE),
                equalTo(capacitySet));
View Full Code Here

    }

    @Test
    public void getCapacityWithOverTimeIsMultipliedByTheCapacityOfTheResourceCalendar() {
        ResourceCalendar calendar = createBasicResourceCalendar(2);
        Capacity capacity = calendar.getCapacityWithOvertime(FUTURE);
        assertThat(capacity, equalTo(capacityForEveryDay.multiplyBy(2)));
    }
View Full Code Here

*/
public class CapacityTest {

    @Test
    public void itHasStandardEffortAndAllowedExtraEffort() {
        Capacity capacity = Capacity.create(hours(8)).withAllowedExtraEffort(hours(2));
        assertThat(capacity.getStandardEffort(),
                equalTo(EffortDuration.hours(8)));
        assertThat(capacity.getAllowedExtraEffort(), equalTo(hours(2)));
    }
View Full Code Here

        assertThat(capacity.getAllowedExtraEffort(), equalTo(hours(2)));
    }

    @Test
    public void ifOnlyTheStandardCapacitySpecifiedIsOverAssignableWithoutLimit() {
        Capacity capacity = Capacity.create(hours(8));
        assertTrue(capacity.isOverAssignableWithoutLimit());
    }
View Full Code Here

        assertTrue(capacity.isOverAssignableWithoutLimit());
    }

    @Test
    public void ifOnlyTheStandardCapacitySpecifiedTheExtraHoursAreNull() {
        Capacity capacity = Capacity.create(hours(8));
        assertThat(capacity.getAllowedExtraEffort(), nullValue());
    }
View Full Code Here

        assertThat(capacity.getAllowedExtraEffort(), nullValue());
    }

    @Test
    public void ifHasAllowedExtraEffortItsNotOverassignableWithoutLimit() {
        Capacity capacity = Capacity.create(hours(8)).withAllowedExtraEffort(hours(0));
        assertFalse(capacity.isOverAssignableWithoutLimit());
    }
View Full Code Here

        assertFalse(capacity.isOverAssignableWithoutLimit());
    }

    @Test
    public void hasAnEqualsAndHashCodeBasedOnStandardEffortAndExtraHours() {
        Capacity a1 = Capacity.create(hours(8)).withAllowedExtraEffort(hours(2));
        Capacity a2 = Capacity.create(hours(8)).withAllowedExtraEffort(hours(2));

        Capacity b1 = Capacity.create(hours(8));

        assertThat(a1, equalTo(a2));
        assertThat(a1.hashCode(), equalTo(a2.hashCode()));
        assertThat(a1, not(equalTo(b1)));
    }
View Full Code Here

        assertFalse(Capacity.zero().isOverAssignableWithoutLimit());
    }

    @Test
    public void albeitTheCapacityIsCreatedFromHibernateAndTheFieldsAreNullDontReturnANullExtraEffort() {
        Capacity capacity = new Capacity();
        assertThat(capacity.getStandardEffort(), equalTo(EffortDuration.zero()));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.calendars.entities.Capacity

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.