use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method withPlainFilename.
@PathPatternsParameterizedTest
void withPlainFilename(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/index");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("index");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method withFilenameAndMatrixVariables.
@PathPatternsParameterizedTest
void withFilenameAndMatrixVariables(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/index;a=A;b=B");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("index");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method multiLevel.
@PathPatternsParameterizedTest
void multiLevel(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/docs/cvs/commit.html");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("docs/cvs/commit");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method withFlashAttributes.
@PathPatternsParameterizedTest
void withFlashAttributes(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/index");
request.setAttribute(RedirectModel.INPUT_ATTRIBUTE, new RedirectModel("name", "value"));
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("index");
assertThat(mv.getModel().size()).isEqualTo(1);
assertThat(mv.getModel().get("name")).isEqualTo("value");
}
use of cn.taketoday.web.RequestContext in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method nestedPathisUsedAsViewName_InBreakingChangeFromSpring12Line.
/**
* This is the expected behavior, and it now has a test to prove it.
* https://opensource.atlassian.com/projects/spring/browse/SPR-2789
*/
@PathPatternsParameterizedTest
void nestedPathisUsedAsViewName_InBreakingChangeFromSpring12Line(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/products/view.html");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("products/view");
assertThat(mv.getModel().isEmpty()).isTrue();
}
Aggregations