Package com.google.sitebricks.routing

Examples of com.google.sitebricks.routing.RoutingDispatcher


        verify(bootstrapper);
    }

    @Test
    public final void doFilter() throws IOException, ServletException {
        RoutingDispatcher dispatcher = createMock(RoutingDispatcher.class);
        HttpServletRequest request = createNiceMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        FilterChain filterChain = createMock(FilterChain.class);
        Respond respond = new StringBuilderRespond() {
            @Override
            public String toString() {
                return SOME_OUTPUT;
            }

            @Override
            public String getRedirect() {
                return null;
            }

            @Override
            public String getContentType() {
                return TEXT_HTML;
            }
        };

        expect(dispatcher.dispatch(request, response))
                .andReturn(respond);

        //nothing set?
        expect(response.getContentType())
                .andReturn(null);
View Full Code Here


    }


    @Test
    public final void doFilterDoesntHandleButProceedsDownChain() throws IOException, ServletException {
        RoutingDispatcher dispatcher = createMock(RoutingDispatcher.class);
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        FilterChain filterChain = createMock(FilterChain.class);

        //meaning no dispatch could be performed...
        expect(dispatcher.dispatch(request, response))
                .andReturn(null);

        filterChain.doFilter(request, response);
        expectLastCall().once();
View Full Code Here

        verify(dispatcher, request, response, filterChain);
    }

    @Test
    public final void doFilterRedirects() throws IOException, ServletException {
        RoutingDispatcher dispatcher = createMock(RoutingDispatcher.class);
        HttpServletRequest request = createNiceMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        FilterChain filterChain = createMock(FilterChain.class);

        Respond respond = createMock(Respond.class);

        //meaning no dispatch could be performed...
        expect(dispatcher.dispatch(request, response))
                .andReturn(respond);

        expect(respond.getRedirect())
                .andReturn(A_REDIRECT_LOCATION);
View Full Code Here

TOP

Related Classes of com.google.sitebricks.routing.RoutingDispatcher

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.