Examples of processGetRequest()


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

                        .from("/home")
                        .on(RequestMethod.GET, RequestMethod.POST)
                        .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
View Full Code Here

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

                        .to(SampleController.class).error(param(Exception.class));
                route().from("/home").on(RequestMethod.GET, RequestMethod.POST).to(SampleController.class)
                        .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));
    }
View Full Code Here

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

                route()
                        .from("/home").on(RequestMethod.GET, RequestMethod.POST)
                        .to(SampleController.class).throwSampleControllerException();
            }
        }).acceptHeader(JSP).spyController(new SampleController());
        routeTester.processGetRequest("/home");
        verify(routeTester.getErrorTarget()).error(any(SampleControllerException.class));
        verify(routeTester.errorViewResponder()).respond(anyObject(), any(RouteContext.class));
        assertThat(routeTester.errorViewResponder().getViewResolver()).isInstanceOf(ErrorViewResolver.class);
    }
View Full Code Here

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

                        .on(RequestMethod.GET, RequestMethod.POST)
                        .produces(JSON)
                        .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("[]");
    }
View Full Code Here

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

                        .on(RequestMethod.GET)
                        .produces(JSON)
                        .to(SampleController.class).throwIllegalStateException();
            }
        }).acceptHeader(JSON).spyController(new SampleController());
        routeTester.processGetRequest("/home");
        verify(routeTester.getErrorTarget()).error(any(SampleControllerException.class));
        verify(routeTester.errorViewResponder()).respond(anyObject(), any(RouteContext.class));
    }
   
}
View Full Code Here

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

                        .on(RequestMethod.GET)
                        .produces(JSP)
                        .to(SampleController.class).find(param("color"), param("brand"));
            }
        }).acceptHeader(HTML).cookie("brand", "Ferrari");
        routeTester.processGetRequest("/cars/red");
        verify(routeTester.<SampleController>getController()).find("red", "Ferrari");
    }

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

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

                        .on(RequestMethod.GET)
                        .produces(JSP)
                        .to(SampleController.class).find(param("color"), param("brand"));
            }
        }).acceptHeader(HTML).cookie("brand", "Ferrari");
        routeTester.processGetRequest("/cars?color=red");
        verify(routeTester.<SampleController>getController()).find("red", "Ferrari");
    }

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

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

                        .on(RequestMethod.GET)
                        .produces(JSP)
                        .to(SampleController.class).find(param("color"), param("brand"));
            }
        }).acceptHeader(HTML).header("brand", "Ferrari");
        routeTester.processGetRequest("/cars?color=red");
        verify(routeTester.<SampleController>getController()).find("red", "Ferrari");
    }
   
    @Test (expected = RuntimeException.class)
    public void testNoRespondersForMediaType() throws Exception {
View Full Code Here

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

                        .on(GET)
                        .produces(new MediaType("custom/type", CustomResponder.class))
                        .to(SampleController.class).find(param("id"));
            }
        }).acceptHeader("custom/type");
        routeTester.processGetRequest("/car/3");
    }

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

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

                        .on(RequestMethod.GET)
                        .produces(JSON)
                        .to(SampleController.class).findByWithCustomParamNames(param(PaginationInfo.class), param("brand"));
            }
        }).acceptHeader(JSON).addResponder(new JsonResponder()).spyController(new SampleController());
        final InvocationResult result = routeTester.processGetRequest("/ints?brand=BMW&myoffset=50&mylimit=5");
        final HttpServletResponse response = result.getRouteContext().getResponse();
        verify(routeTester.<SampleController>getController()).findByWithCustomParamNames(any(PaginationInfo.class), eq("BMW"));
        verify(response).setHeader("TS-Links-Previous", "http://localhost:8080/test/ints?brand=BMW&myoffset=45&mylimit=5");
        verify(response, never()).setHeader(eq("TS-Links-Next"), anyString());
        assertThat(routeTester.getStringWriter().toString()).isEqualTo("[]");
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.