Package org.easymock.internal

Examples of org.easymock.internal.ObjectMethodsFilter


        Factory factory = (Factory) mock;
        return (MockMethodInterceptor) factory.getCallback(0);
    }

    public static MocksControl getControl(Object mock) {
        ObjectMethodsFilter handler;

        try {
            if (Enhancer.isEnhanced(mock.getClass())) {
                handler = (ObjectMethodsFilter) getInterceptor(mock)
                        .getHandler();
            } else if (Proxy.isProxyClass(mock.getClass())) {
                handler = (ObjectMethodsFilter) Proxy
                        .getInvocationHandler(mock);
            } else {
                throw new RuntimeExceptionWrapper(new IllegalArgumentException(
                        "Not a mock: " + mock.getClass().getName()));
            }
            return handler.getDelegate().getControl();
        } catch (ClassCastException e) {
            throw new RuntimeExceptionWrapper(new IllegalArgumentException(
                    "Not a mock: " + mock.getClass().getName()));
        }
    }
View Full Code Here


        Factory factory = (Factory) mock;
        return (MockMethodInterceptor) factory.getCallback(0);
    }

    public static MocksControl getControl(Object mock) {
        ObjectMethodsFilter handler;

        try {
            if (Enhancer.isEnhanced(mock.getClass())) {
                handler = (ObjectMethodsFilter) getInterceptor(mock)
                        .getHandler();
            } else if (Proxy.isProxyClass(mock.getClass())) {
                handler = (ObjectMethodsFilter) Proxy
                        .getInvocationHandler(mock);
            } else {
                throw new RuntimeExceptionWrapper(new IllegalArgumentException(
                        "Not a mock: " + mock.getClass().getName()));
            }
            return handler.getDelegate().getControl();
        } catch (ClassCastException e) {
            throw new RuntimeExceptionWrapper(new IllegalArgumentException(
                    "Not a mock: " + mock.getClass().getName()));
        }
    }
View Full Code Here

    public static void reportMatcher(IArgumentMatcher matcher) {
        LastControl.reportMatcher(matcher);
    }

    private static MocksControl getControl(Object mock) {
        ObjectMethodsFilter handler = (ObjectMethodsFilter) Proxy
                .getInvocationHandler(mock);
        return handler.getDelegate().getControl();
    }
View Full Code Here

    // if the class is no Proxy, ObjectMethodFilter should use the
    // superclasses' name. This is needed for the class extension.
    @Test
    public void toStringForClasses() throws Throwable {
        final ObjectMethodsFilter filter = new ObjectMethodsFilter(Object.class, null, null);
        final Method toString = Object.class.getMethod("toString", new Class[0]);
        assertEquals("EasyMock for " + MockedClass.class.toString(), filter.invoke(new DummyProxy(),
                toString, new Object[0]));
    }
View Full Code Here

   * @param behaviorFactory
   *            the behavior factory.
   */
    protected MockControl(Class toMock, IProxyFactory proxyFactory,
            IBehaviorFactory behaviorFactory) {
        mock = proxyFactory.createProxy(toMock, new ObjectMethodsFilter(
                createDelegator()));
        this.behaviorFactory = behaviorFactory;
        reset();
    }
View Full Code Here

TOP

Related Classes of org.easymock.internal.ObjectMethodsFilter

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.