use of cn.taketoday.web.view.PathPatternsParameterizedTest in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method withPrefix.
@PathPatternsParameterizedTest
void withPrefix(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
controller.setPrefix("mypre_");
RequestContext request = requestFactory.apply("/index.html");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("mypre_index");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.view.PathPatternsParameterizedTest in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method withPrefixAndSuffix.
@PathPatternsParameterizedTest
void withPrefixAndSuffix(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
controller.setPrefix("mypre_");
controller.setSuffix("_mysuf");
RequestContext request = requestFactory.apply("/index.html");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("mypre_index_mysuf");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.view.PathPatternsParameterizedTest in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method withFilenamePlusExtension.
@PathPatternsParameterizedTest
void withFilenamePlusExtension(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/index.html");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("index");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.view.PathPatternsParameterizedTest in project today-infrastructure by TAKETODAY.
the class UrlFilenameViewControllerTests method multiLevelWithMapping.
@PathPatternsParameterizedTest
void multiLevelWithMapping(Function<String, RequestContext> requestFactory) throws Exception {
UrlFilenameViewController controller = new UrlFilenameViewController();
RequestContext request = requestFactory.apply("/cvs/commit.html");
ModelAndView mv = controller.handleRequest(request);
assertThat(mv.getViewName()).isEqualTo("cvs/commit");
assertThat(mv.getModel().isEmpty()).isTrue();
}
use of cn.taketoday.web.view.PathPatternsParameterizedTest in project today-infrastructure by TAKETODAY.
the class RequestMappingInfoTests method matchPatternsCondition.
@PathPatternsParameterizedTest
void matchPatternsCondition(RequestMappingInfo.Builder builder) {
boolean useParsedPatterns = builder.build().getPathPatternsCondition() != null;
HttpServletRequest request = initRequest("GET", "/foo", useParsedPatterns);
RequestMappingInfo info = builder.paths("/foo*", "/bar").build();
RequestMappingInfo expected = builder.paths("/foo*").build();
assertThat(info.getMatchingCondition(new ServletRequestContext(null, request, null))).isEqualTo(expected);
info = builder.paths("/**", "/foo*", "/foo").build();
expected = builder.paths("/foo", "/foo*", "/**").build();
assertThat(info.getMatchingCondition(new ServletRequestContext(null, request, null))).isEqualTo(expected);
}
Aggregations