use of org.springframework.web.servlet.handler.PathPatternsParameterizedTest in project spring-framework by spring-projects.
the class DefaultRequestToViewNameTranslatorTests method testGetViewNameWithNullSuffix.
@PathPatternsParameterizedTest
void testGetViewNameWithNullSuffix(Function<String, MockHttpServletRequest> requestFactory) {
MockHttpServletRequest request = requestFactory.apply(VIEW_NAME);
this.translator.setSuffix(null);
assertViewName(request, VIEW_NAME);
}
use of org.springframework.web.servlet.handler.PathPatternsParameterizedTest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method withPrefix.
@PathPatternsParameterizedTest
void withPrefix(Function<String, MockHttpServletRequest> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
controller.setPrefix("mypre_");
MockHttpServletRequest request = requestFactory.apply("/index.html");
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
assertThat(mv.getViewName()).isEqualTo("mypre_index");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of org.springframework.web.servlet.handler.PathPatternsParameterizedTest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method withFilenameAndMatrixVariables.
@PathPatternsParameterizedTest
void withFilenameAndMatrixVariables(Function<String, MockHttpServletRequest> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
MockHttpServletRequest request = requestFactory.apply("/index;a=A;b=B");
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
assertThat(mv.getViewName()).isEqualTo("index");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of org.springframework.web.servlet.handler.PathPatternsParameterizedTest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method multiLevelMappingWithFallback.
@PathPatternsParameterizedTest
void multiLevelMappingWithFallback(Function<String, MockHttpServletRequest> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
MockHttpServletRequest request = requestFactory.apply("/docs/cvs/commit.html");
exposePathInMapping(request, "/docs/cvs/commit.html");
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
assertThat(mv.getViewName()).isEqualTo("docs/cvs/commit");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of org.springframework.web.servlet.handler.PathPatternsParameterizedTest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method multiLevelWithMapping.
@PathPatternsParameterizedTest
void multiLevelWithMapping(Function<String, MockHttpServletRequest> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
MockHttpServletRequest request = requestFactory.apply("/docs/cvs/commit.html");
exposePathInMapping(request, "/docs/**");
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
assertThat(mv.getViewName()).isEqualTo("cvs/commit");
assertThat(mv.getModel().isEmpty()).isTrue();
}
Aggregations