Package com.mockobjects.dynamic

Examples of com.mockobjects.dynamic.Mock.matchAndReturn()


        mockEndpoint.matchAndReturn("getEndpointURI", toMock.getEndpointURI());
        mockEndpoint.matchAndReturn("getAddress", toMock.getEndpointURI().getUri().toString());
        mockEndpoint.matchAndReturn("toString", toMock.toString());
        mockEndpoint.matchAndReturn("getExchangePattern", toMock.getExchangePattern());
        mockEndpoint.matchAndReturn("getProperties", toMock.getProperties());
        mockEndpoint.matchAndReturn("getFilter", toMock.getFilter());
        mockEndpoint.matchAndReturn("getName", toMock.getName());
        mockEndpoint.matchAndReturn("getResponseTransformers", toMock.getResponseTransformers());
        mockEndpoint.matchAndReturn("hashCode", System.identityHashCode(mockEndpoint));
        return mockEndpoint;
    }
View Full Code Here


        mockEndpoint.matchAndReturn("getAddress", toMock.getEndpointURI().getUri().toString());
        mockEndpoint.matchAndReturn("toString", toMock.toString());
        mockEndpoint.matchAndReturn("getExchangePattern", toMock.getExchangePattern());
        mockEndpoint.matchAndReturn("getProperties", toMock.getProperties());
        mockEndpoint.matchAndReturn("getFilter", toMock.getFilter());
        mockEndpoint.matchAndReturn("getName", toMock.getName());
        mockEndpoint.matchAndReturn("getResponseTransformers", toMock.getResponseTransformers());
        mockEndpoint.matchAndReturn("hashCode", System.identityHashCode(mockEndpoint));
        return mockEndpoint;
    }
View Full Code Here

        mockEndpoint.matchAndReturn("toString", toMock.toString());
        mockEndpoint.matchAndReturn("getExchangePattern", toMock.getExchangePattern());
        mockEndpoint.matchAndReturn("getProperties", toMock.getProperties());
        mockEndpoint.matchAndReturn("getFilter", toMock.getFilter());
        mockEndpoint.matchAndReturn("getName", toMock.getName());
        mockEndpoint.matchAndReturn("getResponseTransformers", toMock.getResponseTransformers());
        mockEndpoint.matchAndReturn("hashCode", System.identityHashCode(mockEndpoint));
        return mockEndpoint;
    }

    /** @return an object that verifies that the argument list was a single MuleEvent */
 
View Full Code Here

        mockEndpoint.matchAndReturn("getExchangePattern", toMock.getExchangePattern());
        mockEndpoint.matchAndReturn("getProperties", toMock.getProperties());
        mockEndpoint.matchAndReturn("getFilter", toMock.getFilter());
        mockEndpoint.matchAndReturn("getName", toMock.getName());
        mockEndpoint.matchAndReturn("getResponseTransformers", toMock.getResponseTransformers());
        mockEndpoint.matchAndReturn("hashCode", System.identityHashCode(mockEndpoint));
        return mockEndpoint;
    }

    /** @return an object that verifies that the argument list was a single MuleEvent */
    public static AnyConstraintMatcher getArgListCheckerMuleEvent()
View Full Code Here

    }

    public void testMessageSplitterRouter() throws Exception
    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());
        session.matchAndReturn("setFlowConstruct", RouterTestUtils.getArgListCheckerFlowConstruct(), null);
       
        OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1endpoint", "test://endpointUri.1", null, new PayloadTypeFilter(Apple.class), null);
        OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Endpoint", "test://endpointUri.2", null, new PayloadTypeFilter(Orange.class), null);
        OutboundEndpoint endpoint3 = getTestOutboundEndpoint("Test3Endpoint", "test://endpointUri.3");
View Full Code Here

        actionContext.setValueStack(stack);
        invocationMock.matchAndReturn("getStack", stack);

        Mock proxyMock = new Mock(ActionProxy.class);
        proxyMock.matchAndReturn("getInvocation", invocation);

        ActionProxy proxy = (ActionProxy) proxyMock.proxy();

        invocationMock.matchAndReturn("getProxy", proxy);
    }
View Full Code Here

        Mock requestMock = new Mock(HttpServletRequest.class);
        requestMock.expectAndReturn("getAttribute", "javax.servlet.include.servlet_path", null);
        requestMock.expectAndReturn("getRequestDispatcher", C.args(C.eq("foo.jsp")), dispatcherMock.proxy());
        requestMock.expect("setAttribute", C.ANY_ARGS); // this is a bad mock, but it works
        requestMock.expect("setAttribute", C.ANY_ARGS); // this is a bad mock, but it works
        requestMock.matchAndReturn("getRequestURI", "foo.jsp");

        Mock responseMock = new Mock(HttpServletResponse.class);
        responseMock.expectAndReturn("isCommitted", Boolean.FALSE);

        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
View Full Code Here

        mockContainer.verify();
    }
   
    public void testInterceptorDestroy() throws Exception {          
        Mock mockInterceptor = new Mock(Interceptor.class);
        mockInterceptor.matchAndReturn("hashCode", 0);
        mockInterceptor.expect("destroy");
       
        InterceptorMapping interceptorMapping = new InterceptorMapping("test", (Interceptor) mockInterceptor.proxy());
       
        InterceptorStackConfig isc = new InterceptorStackConfig.Builder("test").addInterceptor(interceptorMapping).build();
View Full Code Here

       
        Map<String, PackageConfig> packageConfigs = new HashMap<String, PackageConfig>();
        packageConfigs.put("test", packageConfig);
       
        Mock mockContainer = new Mock(Container.class);
        mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
        DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
        container.inject(factory);
        mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), factory);

        Mock mockConfiguration = new Mock(Configuration.class);
View Full Code Here

       
        Mock mockContainer = new Mock(Container.class);
        mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
        DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
        container.inject(factory);
        mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), factory);

        Mock mockConfiguration = new Mock(Configuration.class);
        mockConfiguration.matchAndReturn("getPackageConfigs", packageConfigs);
        mockConfiguration.matchAndReturn("getContainer", mockContainer.proxy());
        mockConfiguration.expect("destroy");
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.