Package org.jmock.matcher

Examples of org.jmock.matcher.ArgumentsMatcher


    public void testMatchesInvocationWithParameters() {
        InvocationMocker invocationMocker = new InvocationMocker(
                new InvocationMatcher[]{
                    new MethodNameMatcher("example"),
                    new ArgumentsMatcher(new Constraint[]{C.eq("arg1"), C.eq("arg2")})}, null);

        assertTrue("Should have matched", invocationMocker.matches(exampleInvocation));
    }
View Full Code Here


    public void testDoesNotMatchWithDifferentParameter() {
        InvocationMocker invocationMocker = new InvocationMocker(
                new InvocationMatcher[]{
                    new MethodNameMatcher("example"),
                    new ArgumentsMatcher(new Constraint[]{C.eq("arg1"), C.eq("not arg2")})}, null);

        assertFalse("Should not have matched", invocationMocker.matches(exampleInvocation));
    }
View Full Code Here

    public static InvocationMatcher args() {
        return NO_ARGS;
    }

    public static InvocationMatcher args(Constraint p) {
        return new ArgumentsMatcher(new Constraint[]{p});
    }
View Full Code Here

    public static InvocationMatcher args(Constraint p) {
        return new ArgumentsMatcher(new Constraint[]{p});
    }

    public static InvocationMatcher args(Constraint p1, Constraint p2) {
        return new ArgumentsMatcher(new Constraint[]{p1, p2});
    }
View Full Code Here

    public static InvocationMatcher args(Constraint p1, Constraint p2) {
        return new ArgumentsMatcher(new Constraint[]{p1, p2});
    }

    public static InvocationMatcher args(Constraint p1, Constraint p2, Constraint p3) {
        return new ArgumentsMatcher(new Constraint[]{p1, p2, p3});
    }
View Full Code Here

    public static InvocationMatcher args(Constraint p1, Constraint p2, Constraint p3) {
        return new ArgumentsMatcher(new Constraint[]{p1, p2, p3});
    }

    public static InvocationMatcher args(Constraint p1, Constraint p2, Constraint p3, Constraint p4) {
        return new ArgumentsMatcher(new Constraint[]{p1, p2, p3, p4});
    }
View Full Code Here

        Constraint[] constraints = new Constraint[argCount];
        for (int i = 0; i < constraints.length; i++) {
            constraints[i] = new IsAnything();
        }

        return new ArgumentsMatcher(constraints);
    }
View Full Code Here

        // Can't overload this method as callee had an Object parameter, and java
        // doesn't do a secondary dispatch on the true underlying type
   
        if (constraintArg instanceof Constraint[]) {
            // to support possible legacy usage of new Contraint[] {...}
            return new ArgumentsMatcher((Constraint[]) constraintArg);
        } else if (constraintArg instanceof Constraint) {
            // to support usage of C.lt(5) type constraints
            return C.args((Constraint) constraintArg);
        } else {
            // normal usage of the overloaded expect/match object parameter
View Full Code Here

TOP

Related Classes of org.jmock.matcher.ArgumentsMatcher

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.