Package org.jmock

Examples of org.jmock.Constraint.eval()


    }

    public void testIsInstanceOf() {
        Constraint p = new IsInstanceOf(Number.class);
        assertTrue(p.eval(new Integer(1)));
        assertTrue(p.eval(new Double(1.0)));
        assertTrue(!p.eval("a string"));
        assertTrue(!p.eval(null));
    }

    public void testIsNot() {
View Full Code Here


    public void testIsInstanceOf() {
        Constraint p = new IsInstanceOf(Number.class);
        assertTrue(p.eval(new Integer(1)));
        assertTrue(p.eval(new Double(1.0)));
        assertTrue(!p.eval("a string"));
        assertTrue(!p.eval(null));
    }

    public void testIsNot() {
        Constraint p = new IsNot(new True());
View Full Code Here

    public void testIsInstanceOf() {
        Constraint p = new IsInstanceOf(Number.class);
        assertTrue(p.eval(new Integer(1)));
        assertTrue(p.eval(new Double(1.0)));
        assertTrue(!p.eval("a string"));
        assertTrue(!p.eval(null));
    }

    public void testIsNot() {
        Constraint p = new IsNot(new True());
        assertTrue(!p.eval(null));
View Full Code Here

        assertTrue(!p.eval(null));
    }

    public void testIsNot() {
        Constraint p = new IsNot(new True());
        assertTrue(!p.eval(null));
        assertTrue(!p.eval(new Object()));
    }

    public void testAnd() {
        Object o = new Object();
View Full Code Here

    }

    public void testIsNot() {
        Constraint p = new IsNot(new True());
        assertTrue(!p.eval(null));
        assertTrue(!p.eval(new Object()));
    }

    public void testAnd() {
        Object o = new Object();
        assertTrue(new And(new True(), new True()).eval(o));
View Full Code Here

        EventObject ev = new EventObject(o);
        EventObject ev2 = new EventObject(new Object());

        Constraint p = new IsEventFrom(o);

        assertTrue(p.eval(ev));
        assertTrue("p should eval to false for an event not from o",
                !p.eval(ev2));
        assertTrue("p should eval to false for objects that are not events",
                !p.eval(o));
    }
View Full Code Here

        Constraint p = new IsEventFrom(o);

        assertTrue(p.eval(ev));
        assertTrue("p should eval to false for an event not from o",
                !p.eval(ev2));
        assertTrue("p should eval to false for objects that are not events",
                !p.eval(o));
    }

    private static class DerivedEvent extends EventObject {
View Full Code Here

        assertTrue(p.eval(ev));
        assertTrue("p should eval to false for an event not from o",
                !p.eval(ev2));
        assertTrue("p should eval to false for objects that are not events",
                !p.eval(o));
    }

    private static class DerivedEvent extends EventObject {
        public DerivedEvent(Object source) {
            super(source);
View Full Code Here

        EventObject wrong_type = new EventObject(o);
        EventObject wrong_source_and_type = new EventObject(new Object());

        Constraint p = new IsEventFrom(DerivedEvent.class, o);

        assertTrue(p.eval(good_ev));
        assertTrue("p should eval to false for an event not from o",
                !p.eval(wrong_source));
        assertTrue("p should eval to false for an event of the wrong type",
                !p.eval(wrong_type));
        assertTrue("p should eval to false for an event of the wrong type " +
View Full Code Here

        Constraint p = new IsEventFrom(DerivedEvent.class, o);

        assertTrue(p.eval(good_ev));
        assertTrue("p should eval to false for an event not from o",
                !p.eval(wrong_source));
        assertTrue("p should eval to false for an event of the wrong type",
                !p.eval(wrong_type));
        assertTrue("p should eval to false for an event of the wrong type " +
                "and from the wrong source",
                !p.eval(wrong_source_and_type));
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.