Class MockMultipartHttpServletRequestBuilder
- java.lang.Object
- org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder
- org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder
- All Implemented Interfaces:
Mergeable,ConfigurableSmartRequestBuilder<MockHttpServletRequestBuilder>,RequestBuilder,SmartRequestBuilder
public class MockMultipartHttpServletRequestBuilder extends MockHttpServletRequestBuilder
Default builder forMockMultipartHttpServletRequest.- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Arjen Poutsma
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MockHttpServletRequestcreateServletRequest(ServletContext servletContext)Create a newMockMultipartHttpServletRequestbased on the suppliedServletContextand theMockMultipartFilesadded to this builder.MockMultipartHttpServletRequestBuilderfile(String name, byte[] content)Create a new MockMultipartFile with the given content.MockMultipartHttpServletRequestBuilderfile(MockMultipartFile file)Add the given MockMultipartFile.Objectmerge(Object parent)Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.Methods inherited from class org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder
accept, accept, buildRequest, characterEncoding, content, content, contentType, contentType, contextPath, cookie, flashAttr, flashAttrs, header, headers, isMergeEnabled, locale, locale, param, params, pathInfo, postProcessRequest, principal, requestAttr, secure, servletPath, session, sessionAttr, sessionAttrs, with
Method Detail
file
public MockMultipartHttpServletRequestBuilder file(String name, byte[] content)
Create a new MockMultipartFile with the given content.- Parameters:
name- the name of the filecontent- the content of the file
file
public MockMultipartHttpServletRequestBuilder file(MockMultipartFile file)
Add the given MockMultipartFile.- Parameters:
file- the multipart file
merge
public Object merge(Object parent)
Description copied from class:MockHttpServletRequestBuilderMerges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.- Specified by:
mergein interfaceMergeable- Overrides:
mergein classMockHttpServletRequestBuilder- Parameters:
parent- the parentRequestBuilderto inherit properties from- Returns:
- the result of the merge
createServletRequest
protected final MockHttpServletRequest createServletRequest(ServletContext servletContext)
Create a newMockMultipartHttpServletRequestbased on the suppliedServletContextand theMockMultipartFilesadded to this builder.- Overrides:
createServletRequestin classMockHttpServletRequestBuilder