Package org.jboss.aerogear.controller.mocks

Examples of org.jboss.aerogear.controller.mocks.RouteTester.jspResponder()


                        .to(SampleController.class).throwIllegalStateException();
            }
        }).acceptHeader(JSP).spyController(new SampleController());
        routeTester.processGetRequest("/home");
        verify(routeTester.<SampleController>getController()).errorPage();
        verify(routeTester.jspResponder()).respond(anyObject(), any(RouteContext.class));
    }

    @Test
    public void testOnExceptions() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here


                        .throwSampleControllerException();
            }
        }).acceptHeader(MediaType.JSP).spyController(new SampleController());
        routeTester.processGetRequest("/home");
        verify(routeTester.<SampleController>getController()).error(any(IllegalArgumentException.class));
        verify(routeTester.jspResponder()).respond(anyObject(), any(RouteContext.class));
        verify(routeTester.jsonResponder(), never()).respond(anyObject(), any(RouteContext.class));
    }

    @Test
    public void testDefaultErrorRoute() throws Exception {
View Full Code Here

                        .to(SampleController.class).save(param("color"), param("brand"));
            }
        }).acceptHeader(JSP).header("brand", "Lada");
        routeTester.processPostRequest("/cars?color=gray");
        verify(routeTester.<SampleController>getController()).save("gray", "Lada");
        verify(routeTester.jspResponder()).respond(anyObject(), any(RouteContext.class));
    }

    @Test
    public void testAnyResponder() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).find(param("id"));
            }
        }).requestMethod(GET).acceptHeader(ANY);
        routeTester.process("/cars/10");
        verify(routeTester.<SampleController>getController()).find("10");
        verify(routeTester.jspResponder()).respond(anyObject(), any(RouteContext.class));
    }

    @Test
    public void testAnyResponderEmptyAcceptHeader() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).find(param("id"));
            }
        }).requestMethod(GET);
        routeTester.process("/cars/10");
        verify(routeTester.<SampleController>getController()).find("10");
        verify(routeTester.jspResponder()).respond(anyObject(), any(RouteContext.class));
    }

    @Test
    public void testConsumes() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).findWithConstant("constant", param("id"));
            }
        });
        routeTester.acceptHeader(HTML).processGetRequest("/car/3");
        verify(routeTester.<SampleController>getController()).findWithConstant("constant", "3");
        verify(routeTester.jspResponder()).respond(any(), any(RouteContext.class));
    }
   
    @Test
    public void testMvcRouteWithPathParamAndConstant() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).findWithConstantReversed(param("id"), "constant");
            }
        });
        routeTester.acceptHeader(HTML).processGetRequest("/car/3");
        verify(routeTester.<SampleController>getController()).findWithConstantReversed("3", "constant");
        verify(routeTester.jspResponder()).respond(any(), any(RouteContext.class));
    }
   
    @Test
    public void testMvcRouteWithMultipleConstants() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).findWithConstantReversed("constant1", "constant2");
            }
        });
        routeTester.acceptHeader(HTML).processGetRequest("/car");
        verify(routeTester.<SampleController>getController()).findWithConstantReversed("constant1", "constant2");
        verify(routeTester.jspResponder()).respond(any(), any(RouteContext.class));
    }
   
    @Test
    public void testMvcRouteWithParamsInConstantString() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).processPath("{id}?title={title}&lastname={lastname}?propertyName=value");
            }
        });
        routeTester.acceptHeader(HTML).processGetRequest("/car/10?title=Mr&lastname=Babar");
        verify(routeTester.<SampleController>getController()).processPath("10?title=Mr&lastname=Babar?propertyName=value");
        verify(routeTester.jspResponder()).respond(any(), any(RouteContext.class));
    }
   
    @Test
    public void testMvcRouteWithConstantWithParam() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

                        .to(SampleController.class).processPathWithType("/remoteserver/{id}?title={title}&lastname={lastname}?propertyName=value", String.class);
            }
        });
        routeTester.acceptHeader(HTML).processGetRequest("/car/10?title=Mr&lastname=Babar");
        verify(routeTester.<SampleController>getController()).processPathWithType("/remoteserver/10?title=Mr&lastname=Babar?propertyName=value", String.class);
        verify(routeTester.jspResponder()).respond(any(), any(RouteContext.class));
    }
   
    @Test
    public void testRouteWithMultiplePathParams() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
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.