Package net.emaze.dysfunctional.dispatching.logic

Examples of net.emaze.dysfunctional.dispatching.logic.Proposition


        }

        @Test
        public void canSpyAProposition() {
            final Box<Boolean> result = new Box<Boolean>();
            final Proposition spied = Spies.spy(new Yes(), result);
            Assert.assertNotNull(spied);
        }
View Full Code Here


            Assert.assertNotNull(monitor);
        }

        @Test
        public void canMonitorAProposition() {
            final Proposition monitor = Spies.monitor(new Yes(), accumulator);
            Assert.assertNotNull(monitor);
        }
View Full Code Here

    public static class CurryPredicates {

        @Test
        public void canCurryPredicate() {
            final Proposition adapted = Dispatching.curry(new Always<O>(), O.ONE);
            Assert.assertNotNull(adapted);
        }
View Full Code Here

    }

    @Test
    public void callingIncrementsTheAtomicLong() {
        final AtomicLong state = new AtomicLong();
        final Proposition spy = new MonitoringProposition(new Yes(), state);
        spy.state();
        Assert.assertEquals(1l, state.get());
    }
View Full Code Here

    }

    @Test
    public void callingThePropositionYieldsProviderResult() {
        final Boolean expected = Boolean.TRUE;
        final Proposition proposition = new ProviderToProposition(new ConstantProvider<Boolean>(expected));
        Assert.assertEquals(expected, proposition.state());
    }
View Full Code Here

    @Test
    public void callingTheBinderPassesBoundParameter() {
        final Box<O> param = Box.empty();
        final Predicate<O> spy = Spies.spy1st(new Always<O>(), param);
        final Proposition proposition = new PredicateBinder<O>(spy, O.ONE);
        proposition.state();
        Assert.assertEquals(O.ONE, param.getContent());
    }
View Full Code Here

    @Test
    public void callingTheBinderYieldsPredicateResult() {
        final Box<Boolean> result = Box.empty();
        final Predicate<O> spy = Spies.spyRes(new Always<O>(), result);
        final Proposition proposition = new PredicateBinder<O>(spy, O.ONE);
        proposition.state();
        Assert.assertEquals(Boolean.TRUE, result.getContent());
    }
View Full Code Here

    }

    @Test
    public void callingCapturesTheResult() {
        final Box<Boolean> result = Box.empty();
        final Proposition spy = new CapturingProposition(new Yes(), result);
        spy.state();
        Assert.assertEquals(Box.of(true), result);
    }
View Full Code Here

            Assert.assertNotNull(adapted);
        }

        @Test
        public void canAdaptProviderToProposition() {
            final Proposition adapted = Dispatching.proposition(new ConstantProvider<Boolean>(Boolean.TRUE));
            Assert.assertNotNull(adapted);
        }
View Full Code Here

TOP

Related Classes of net.emaze.dysfunctional.dispatching.logic.Proposition

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.