Package net.emaze.dysfunctional.testing

Examples of net.emaze.dysfunctional.testing.O


        Assert.assertEquals(right, perform.value().intValue());
    }

    @Test
    public void callingOrElseOnJustYieldsJustValue() {
        final O got = Maybe.just(O.ONE).orElse(O.ANOTHER);
        Assert.assertEquals(O.ONE, got);
    }
View Full Code Here


        Assert.assertEquals(O.ONE, got);
    }

    @Test
    public void callingOrElseOnNothingYieldsParameter() {
        final O got = Maybe.<O>nothing().orElse(O.ANOTHER);
        Assert.assertEquals(O.ANOTHER, got);
    }
View Full Code Here

public class PureBoxTest {

    @Test
    public void pureYieldsBoxWithContent() {
        final O value = O.ONE;
        final Box<O> got = new PureBox<O>().perform(value);
        Assert.assertEquals(Box.of(value), got);
    }
View Full Code Here

public class PureEitherTest {

    @Test
    public void pureYieldsRightEither() {
        final O value = O.ONE;
        final Either<String, O> got = new PureEither<String, O>().perform(value);
        Assert.assertEquals(Maybe.just(O.ONE), got.maybe());
    }
View Full Code Here

        UNDER_TEST.perform(null, O.ONE);
    }

    @Test
    public void callingWithJustYieldsJustValue() {
        final O got = UNDER_TEST.perform(Maybe.just(O.ONE), O.ANOTHER);
        Assert.assertEquals(O.ONE, got);
    }
View Full Code Here

        Assert.assertEquals(O.ONE, got);
    }

    @Test
    public void callingWithNothingYieldsSecondParameter() {
        final O got = UNDER_TEST.perform(Maybe.<O>nothing(), O.ANOTHER);
        Assert.assertEquals(O.ANOTHER, got);
    }
View Full Code Here

        new IsOdd<O, O>(null, O.ONE);
    }

    @Test
    public void isOddWhenModulusIsNotEqualToZero() {
        final O zero = O.ONE;
        final Predicate<O> odd = new IsOdd<O, O>(new ModulusPolicy<O, O, Integer>() {

            @Override
            public O modulus(O lhs, Integer modulus) {
                return O.ANOTHER;
View Full Code Here

        Assert.assertTrue(odd.accept(O.ONE));
    }

    @Test
    public void isNotOddWhenModulusIsEqualToZero() {
        final O zero = O.ONE;
        final Predicate<O> odd = new IsOdd<O, O>(new ModulusPolicy<O, O, Integer>() {

            @Override
            public O modulus(O lhs, Integer modulus) {
                return O.ONE;
View Full Code Here

            @Override
            public O sum(O lhs, O rhs) {
                return O.YET_ANOTHER;
            }
        });
        final O got = sum.perform(O.ONE, O.ANOTHER);
        Assert.assertEquals(O.YET_ANOTHER, got);
    }
View Full Code Here

        new IsEven<O, O>(null, O.ONE);
    }

    @Test
    public void isEvenWhenModulusIsEqualToZero() {
        final O zero = O.ONE;
        final Predicate<O> even = new IsEven<O, O>(new ModulusPolicy<O, O, Integer>() {

            @Override
            public O modulus(O lhs, Integer modulus) {
                return O.ONE;
View Full Code Here

TOP

Related Classes of net.emaze.dysfunctional.testing.O

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.