Java Code Examples for org.springframework.mock.web.test.MockMultipartHttpServletRequest#setRequestURI()

The following examples show how to use org.springframework.mock.web.test.MockMultipartHttpServletRequest#setRequestURI() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example 2
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example 3
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example 4
Source File: ServletAnnotationControllerHandlerMethodTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example 5
Source File: ServletAnnotationControllerHandlerMethodTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example 6
Source File: ServletAnnotationControllerHandlerMethodTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example 7
Source File: ServletAnnotationControllerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void multipartFileAsSingleString() throws Exception {
	initServlet(MultipartController.class);

	MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
	request.setRequestURI("/singleString");
	request.addFile(new MockMultipartFile("content", "Juergen".getBytes()));
	MockHttpServletResponse response = new MockHttpServletResponse();
	servlet.service(request, response);
	assertEquals("Juergen", response.getContentAsString());
}
 
Example 8
Source File: ServletAnnotationControllerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void multipartFileAsStringArray() throws Exception {
	initServlet(MultipartController.class);

	MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
	request.setRequestURI("/stringArray");
	request.addFile(new MockMultipartFile("content", "Juergen".getBytes()));
	MockHttpServletResponse response = new MockHttpServletResponse();
	servlet.service(request, response);
	assertEquals("Juergen", response.getContentAsString());
}
 
Example 9
Source File: ServletAnnotationControllerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void multipartFilesAsStringArray() throws Exception {
	initServlet(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();
	servlet.service(request, response);
	assertEquals("Juergen-Eva", response.getContentAsString());
}
 
Example 10
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 11
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 12
Source File: ServletAnnotationControllerHandlerMethodTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}