Examples of acceptHeader()


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

                        .on(GET)
                        .produces(JSON)
                        .to(SampleController.class).findByWithDefaults(param(PaginationInfo.class), param("color"));
            }
        }).spyController(new SampleController()).addResponder(new JsonResponder());
        final InvocationResult result = routeTester.acceptHeader(JSON).processGetRequest("/ints?color=blue");
        verify(result.getRouteContext().getResponse()).setHeader(eq("Link"), anyString());
        verify(routeTester.<SampleController>getController()).findByWithDefaults(any(PaginationInfo.class), eq("blue"));
        assertThat(routeTester.getStringWriter().toString()).isEqualTo("[0,1,2,3,4,5,6,7,8,9]");
    }
View Full Code Here

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

                        .on(RequestMethod.GET)
                        .produces(JSON)
                        .to(SampleController.class).findByWithCustomHeadersDefaultPrefix(param(PaginationInfo.class), param("color"));
            }
        }).spyController(new SampleController()).addResponder(new JsonResponder());
        final InvocationResult result = routeTester.acceptHeader(JSON).processGetRequest("/ints?color=blue");
        final HttpServletResponse response = result.getRouteContext().getResponse();
        verify(routeTester.<SampleController>getController()).findByWithCustomHeadersDefaultPrefix(any(PaginationInfo.class), eq("blue"));
        verify(response).setHeader("AG-Links-Next", "http://localhost:8080/test/ints?color=blue&offset=10&limit=10");
        verify(response, never()).setHeader(eq("AG-Links-Previous"), anyString());
        assertThat(routeTester.getStringWriter().toString()).isEqualTo("[0,1,2,3,4,5,6,7,8,9]");
View Full Code Here

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

                        .produces(JSON)
                        .to(SampleController.class).findByWithCustomHeadersPrefix(param(PaginationInfo.class), param("color"));
            }
        }).addResponder(new JsonResponder()).spyController(new SampleController())
        .param("color", "blue").param("offset", "0").param("limit", "5");
        final InvocationResult result = routeTester.acceptHeader(JSON).processGetRequest("/ints");
        final HttpServletResponse response = result.getRouteContext().getResponse();
        verify(routeTester.<SampleController>getController()).findByWithCustomHeadersPrefix(any(PaginationInfo.class), eq("blue"));
        verify(response).setHeader("Test-Links-Next", "http://localhost:8080/test/ints?color=blue&offset=5&limit=5");
        verify(response, never()).setHeader(eq("Test-Links-Previous"), anyString());
        assertThat(routeTester.getStringWriter().toString()).isEqualTo("[0,1,2,3,4]");
View Full Code Here

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

                        .produces(JSON)
                        .to(SampleController.class).findByWithCustomHeadersPrefix(param(PaginationInfo.class), param("color"));
            }
        }).addResponder(new JsonResponder()).spyController(new SampleController())
        .param("color", "blue").param("offset", "5").param("limit", "5");
        final InvocationResult result = routeTester.acceptHeader(JSON).processGetRequest("/ints");
        final HttpServletResponse response = result.getRouteContext().getResponse();
        verify(routeTester.<SampleController>getController()).findByWithCustomHeadersPrefix(any(PaginationInfo.class), eq("blue"));
        verify(response).setHeader("Test-Links-Previous", "http://localhost:8080/test/ints?color=blue&offset=0&limit=5");
        verify(response).setHeader("Test-Links-Next", "http://localhost:8080/test/ints?color=blue&offset=10&limit=5");
        assertThat(routeTester.getStringWriter().toString()).isEqualTo("[5,6,7,8,9]");
View Full Code Here

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

                        .on(RequestMethod.GET)
                        .produces(JSP)
                        .to(SampleController.class).find(param("color"), param("brand", "Ferrari"));
            }
        }).spyController(new SampleController());
        final InvocationResult result = routeTester.acceptHeader(JSP).processGetRequest("/cars");
        assertThat(result.getResult()).isInstanceOf(MissingRequestParameterException.class);
    }   
   
    @Test
    public void testMvcRouteWithConstantAndPathParam() throws Exception {
View Full Code Here

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

                        .on(GET)
                        .produces(JSP)
                        .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
View Full Code Here

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

                        .on(GET)
                        .produces(JSP)
                        .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
View Full Code Here

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

                        .on(GET)
                        .produces(JSP)
                        .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
View Full Code Here

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

                        .on(GET)
                        .produces(JSP)
                        .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
View Full Code Here

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

                        .on(GET)
                        .produces(JSP)
                        .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
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.