Examples of jsonResponder()


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

            }
        }).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 {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

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

                        .to(SampleController.class).throwIllegalStateException();
            }
        }).acceptHeader(JSON).spyController(new SampleController());
        final InvocationResult processResult = routeTester.processGetRequest("/home");
        verify(routeTester.<SampleController>getController()).errorResponse();
        verify(routeTester.jsonResponder()).respond(anyObject(), any(RouteContext.class));
        verify(processResult.getRouteContext().getResponse()).setStatus(HttpServletResponse.SC_NOT_FOUND);
        assertThat(routeTester.getStringWriter().toString()).isEqualTo("[]");
    }
   
    @Test
View Full Code Here

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

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

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

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

                        .to(SampleController.class).find(param("id",Long.class));
            }
        });
        routeTester.acceptHeader("application/*;limit=500, text/*").processGetRequest("/car/3");
        verify(routeTester.<SampleController>getController()).find(new Long(3));
        verify(routeTester.jsonResponder()).respond(any(), any(RouteContext.class));
    }
   
    @Test
    public void testRouteWithMultiplePathParamsAndSubpath() throws Exception {
        final RouteTester routeTester = RouteTester.from(new AbstractRoutingModule() {
View Full Code Here

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

                        .to(SampleController.class).find(param("id"));
            }
        });
        routeTester.acceptHeader(JSON).processGetRequest("/car/3");
        verify(routeTester.<SampleController>getController()).find("3");
        verify(routeTester.jsonResponder()).respond(any(), any(RouteContext.class));
    }

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

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

                        .to(SampleController.class).find(param("id",Long.class));
            }
        });
        routeTester.acceptHeader(JSON).processGetRequest("/car/3");
        verify(routeTester.<SampleController>getController()).find(new Long(3));
        verify(routeTester.jsonResponder()).respond(any(), any(RouteContext.class));
    }

    @Test
    public void testFormParameters() 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.