use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method withPrefixAndSuffix.
@Test
public void withPrefixAndSuffix() throws Exception {
UrlFilenameViewController ctrl = new UrlFilenameViewController();
ctrl.setPrefix("mypre_");
ctrl.setSuffix("_mysuf");
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/index.html");
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = ctrl.handleRequest(request, response);
assertEquals("mypre_index_mysuf", mv.getViewName());
assertTrue(mv.getModel().isEmpty());
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method withPlainFilename.
@Test
public void withPlainFilename() throws Exception {
UrlFilenameViewController ctrl = new UrlFilenameViewController();
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/index");
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = ctrl.handleRequest(request, response);
assertEquals("index", mv.getViewName());
assertTrue(mv.getModel().isEmpty());
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method withFilenamePlusExtension.
@Test
public void withFilenamePlusExtension() throws Exception {
UrlFilenameViewController ctrl = new UrlFilenameViewController();
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/index.html");
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = ctrl.handleRequest(request, response);
assertEquals("index", mv.getViewName());
assertTrue(mv.getModel().isEmpty());
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method multiLevel.
@Test
public void multiLevel() throws Exception {
UrlFilenameViewController ctrl = new UrlFilenameViewController();
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/docs/cvs/commit.html");
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = ctrl.handleRequest(request, response);
assertEquals("docs/cvs/commit", mv.getViewName());
assertTrue(mv.getModel().isEmpty());
}
use of org.springframework.mock.web.test.MockHttpServletRequest in project spring-framework by spring-projects.
the class UrlFilenameViewControllerTests method withSuffix.
@Test
public void withSuffix() throws Exception {
UrlFilenameViewController ctrl = new UrlFilenameViewController();
ctrl.setSuffix("_mysuf");
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/index.html");
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = ctrl.handleRequest(request, response);
assertEquals("index_mysuf", mv.getViewName());
assertTrue(mv.getModel().isEmpty());
}
Aggregations