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
Default builder for
MockMultipartHttpServletRequest
.- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Arjen Poutsma
-
Method Summary
Modifier and TypeMethodDescriptionprotected final MockHttpServletRequest
createServletRequest
(ServletContext servletContext) Create a newMockMultipartHttpServletRequest
based on the suppliedServletContext
and theMockMultipartFiles
added to this builder.Add a newMockMultipartFile
with the given content.file
(MockMultipartFile file) Add the givenMockMultipartFile
.Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.AddPart
components to the request.Methods inherited from class org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder
accept, accept, buildRequest, characterEncoding, characterEncoding, content, content, contentType, contentType, contextPath, cookie, flashAttr, flashAttrs, header, headers, isMergeEnabled, locale, locale, param, params, pathInfo, postProcessRequest, principal, queryParam, queryParams, requestAttr, secure, servletPath, session, sessionAttr, sessionAttrs, with
-
Method Details
-
file
Add a newMockMultipartFile
with the given content.- Parameters:
name
- the name of the filecontent
- the content of the file
-
file
Add the givenMockMultipartFile
.- Parameters:
file
- the multipart file
-
part
AddPart
components to the request.- Parameters:
parts
- one or more parts to add- Since:
- 5.0
-
merge
Description copied from class:MockHttpServletRequestBuilder
Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.- Specified by:
merge
in interfaceMergeable
- Overrides:
merge
in classMockHttpServletRequestBuilder
- Parameters:
parent
- the parentRequestBuilder
to inherit properties from- Returns:
- the result of the merge
-
createServletRequest
Create a newMockMultipartHttpServletRequest
based on the suppliedServletContext
and theMockMultipartFiles
added to this builder.- Overrides:
createServletRequest
in classMockHttpServletRequestBuilder
-