Examples of Share


Examples of org.libreplan.business.planner.entities.Share

        assertArrayEquals(new int[] { 4, 6, 0, 0, 0 }, difference);
    }

    @Test
    public void canHandleAllMaximumValueIntegers() {
        givenDivisionShare(new Share(Integer.MAX_VALUE), new Share(
                Integer.MAX_VALUE), new Share(Integer.MAX_VALUE));
        ShareDivision plus = shareDivision.plus(2);
        int[] difference = shareDivision.to(plus);
        assertArrayEquals(new int[] { 1, 1, 0 }, difference);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

        assertArrayEquals(new int[] { 1, 1, 0 }, difference);
    }

    @Test
    public void canHandleMaximumValueIntegersAndMinimumValue() {
        givenDivisionShare(new Share(Integer.MIN_VALUE), new Share(
                Integer.MAX_VALUE), new Share(Integer.MAX_VALUE), new Share(
                Integer.MIN_VALUE), new Share(Integer.MIN_VALUE), new Share(
                Integer.MAX_VALUE));
        ShareDivision plus = shareDivision.plus(9);
        int[] difference = shareDivision.to(plus);
        assertArrayEquals(new int[] { 3, 0, 0, 3, 3, 0 }, difference);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

    }

    @Test
    @Ignore("TODO handling substractions")
    public void canDistributeSubstraction() {
        givenDivisionShare(new Share(2), new Share(5), new Share(10));
        assertThat(shareDivision.plus(-1), haveValues(2, 5, 9));
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

public class ShareTest {

    private Share share;

    private void givenHours(int hours) {
        share = new Share(hours);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

        share = new Share(hours);
    }

    @Test
    public void canHaveNegativeHours() {
        new Share(-1);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

        new Share(-1);
    }

    @Test
    public void canHaveZeroHours() {
        new Share(0);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

    }

    @Test
    public void canAddHours() {
        givenHours(10);
        Share newShare = share.plus(5);
        assertThat(newShare.getHours(), equalTo(15));
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

    }

    @Test
    public void canSubstract() {
        givenHours(5);
        Share newShare = share.plus(-2);
        assertThat(newShare.getHours(), equalTo(3));
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

    }

    @Test
    public void twoSharesEqualIfHaveTheSameHours() {
        givenHours(10);
        assertThat(share, equalTo(new Share(10)));
        assertThat(share.hashCode(), equalTo(new Share(10).hashCode()));
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.Share

        return max.getAllowedExtraEffort();

    }

    private static Share createNormalCapacityShare(Capacity each) {
        return new Share(-each.getStandardEffort().getSeconds());
    }
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.