Package net.emaze.dysfunctional.dispatching.spying

Source Code of net.emaze.dysfunctional.dispatching.spying.CapturingPropositionTest

package net.emaze.dysfunctional.dispatching.spying;

import net.emaze.dysfunctional.dispatching.logic.Proposition;
import net.emaze.dysfunctional.dispatching.logic.Yes;
import net.emaze.dysfunctional.options.Box;
import org.junit.Assert;
import org.junit.Test;

/**
*
* @author rferranti
*/
public class CapturingPropositionTest {

    @Test(expected = IllegalArgumentException.class)
    public void creatingSpyWithNullAdaptedYieldsException() {
        new CapturingProposition(null, Box.<Boolean>empty());
    }

    @Test(expected = IllegalArgumentException.class)
    public void creatingSpyWithNullBoxYieldsException() {
        new CapturingProposition(new Yes(), null);
    }

    @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);
    }
}
TOP

Related Classes of net.emaze.dysfunctional.dispatching.spying.CapturingPropositionTest

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.