Package org.jmock.core

Examples of org.jmock.core.InvocationMocker$Describer


        builder.match(expectation);
        return builder;
    }

    private NameMatchBuilder addNewInvocationMocker() {
        InvocationMocker mocker = new InvocationMocker(new InvocationMockerDescriber());
        addInvokable(mocker);

        return new InvocationMockerBuilder( mocker, this, getMockedType() );
    }
View Full Code Here


        return newDummy(interfaceClass, "dummy" + Formatting.classShortName(interfaceClass));
    }

    public static Object newDummy( final Class interfaceClass, final String name ) {
        CoreMock mock = new CoreMock(interfaceClass, name);
        InvocationMocker mocker = new InvocationMocker();

        mocker.addMatcher(new StatelessInvocationMatcher()
        {
            public boolean matches( Invocation invocation ) {
                return invocation.invokedMethod.getDeclaringClass() == interfaceClass;
            }

            public StringBuffer describeTo( StringBuffer buf ) {
                return buf.append("any invokedMethod declared in " + interfaceClass);
            }
        });
        mocker.setStub(new CustomStub("dummy invokedMethod")
        {
            public Object invoke( Invocation invocation ) throws Throwable {
                throw new NotImplementedException(invocation.invokedMethod.getName() + " called on " + name);
            }
        });
View Full Code Here

        return newDummy(interfaceClass, "dummy" + Formatting.classShortName(interfaceClass));
    }

    public static Object newDummy( final Class interfaceClass, final String name ) {
        CoreMock mock = new CoreMock(interfaceClass, name);
        InvocationMocker mocker = new InvocationMocker();

        mocker.addMatcher(new StatelessInvocationMatcher()
        {
            public boolean matches( Invocation invocation ) {
                return invocation.invokedMethod.getDeclaringClass() == interfaceClass;
            }

            public StringBuffer describeTo( StringBuffer buf ) {
                return buf.append("any invokedMethod declared in " + interfaceClass);
            }
        });
        mocker.setStub(new CustomStub("dummy invokedMethod")
        {
            public Object invoke( Invocation invocation ) throws Throwable {
                throw new NotImplementedException(invocation.invokedMethod.getName() + " called on " + name);
            }
        });
View Full Code Here

        return newDummy(dummyType, "dummy" + Formatting.classShortName(dummyType));
    }
   
    public Object newDummy( final Class type, final String name ) {
        DynamicMock mock = newCoreMock(type, name);
        InvocationMocker mocker = new InvocationMocker();
       
        mocker.addMatcher(new StatelessInvocationMatcher() {
            public boolean matches( Invocation invocation ) {
                return invocation.invokedMethod.getDeclaringClass() == type;
            }

            public StringBuffer describeTo( StringBuffer buf ) {
                return buf.append("any invokedMethod declared in " + type);
            }
        });
        mocker.setStub(new CustomStub("dummy invokedMethod") {
            public Object invoke( Invocation invocation ) throws Throwable {
                throw new NotImplementedException(invocation.invokedMethod.getName() + " called on " + name);
            }
        });
       
View Full Code Here

TOP

Related Classes of org.jmock.core.InvocationMocker$Describer

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.