use of org.springframework.mock.web.test.MockMultipartHttpServletRequest in project spring-framework by spring-projects.
the class ServletAnnotationControllerHandlerMethodTests method multipartFilesAsStringArray.
@Test
public void multipartFilesAsStringArray() throws Exception {
initServletWithControllers(MultipartController.class);
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
request.setRequestURI("/stringArray");
request.addFile(new MockMultipartFile("content", "Juergen".getBytes()));
request.addFile(new MockMultipartFile("content", "Eva".getBytes()));
MockHttpServletResponse response = new MockHttpServletResponse();
getServlet().service(request, response);
assertEquals("Juergen-Eva", response.getContentAsString());
}
use of org.springframework.mock.web.test.MockMultipartHttpServletRequest in project spring-framework by spring-projects.
the class ServletAnnotationControllerHandlerMethodTests method multipartFileAsSingleString.
@Test
public void multipartFileAsSingleString() throws Exception {
initServletWithControllers(MultipartController.class);
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
request.setRequestURI("/singleString");
request.addFile(new MockMultipartFile("content", "Juergen".getBytes()));
MockHttpServletResponse response = new MockHttpServletResponse();
getServlet().service(request, response);
assertEquals("Juergen", response.getContentAsString());
}
use of org.springframework.mock.web.test.MockMultipartHttpServletRequest in project spring-framework by spring-projects.
the class ServletAnnotationControllerHandlerMethodTests method multipartFileAsStringArray.
@Test
public void multipartFileAsStringArray() throws Exception {
initServletWithControllers(MultipartController.class);
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
request.setRequestURI("/stringArray");
request.addFile(new MockMultipartFile("content", "Juergen".getBytes()));
MockHttpServletResponse response = new MockHttpServletResponse();
getServlet().service(request, response);
assertEquals("Juergen", response.getContentAsString());
}
Aggregations