org.springframework.test.web.servlet.request

## Class MockMultipartHttpServletRequestBuilder

- java.lang.Object
- - org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder
  - - org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder

All Implemented Interfaces:
  Mergeable, RequestBuilder

    public class MockMultipartHttpServletRequestBuilder
    extends MockHttpServletRequestBuilder

Default builder for `MockMultipartHttpServletRequest`.

Since:
  3.2
Author:
  Rossen Stoyanchev, Arjen Poutsma

### Method Summary

Methods
`protected MockHttpServletRequest` `createServletRequest(ServletContext servletContext)` Creates a new `MockHttpServletRequest` based on the given `ServletContext`.
`MockMultipartHttpServletRequestBuilder` `file(MockMultipartFile file)` Add the given MockMultipartFile.
`MockMultipartHttpServletRequestBuilder` `file(String name, byte[] content)` Create a new MockMultipartFile with the given content.
`Object` `merge(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, buildRequest, characterEncoding, content, content, contentType, contextPath, cookie, flashAttr, flashAttrs, header, headers, isMergeEnabled, locale, param, pathInfo, principal, requestAttr, secure, servletPath, session, sessionAttr, sessionAttrs, with`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### file

    public MockMultipartHttpServletRequestBuilder file(String name,
                                              byte[] content)

Create a new MockMultipartFile with the given content.

Parameters:
  `name` - the name of the file
  `content` - 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: `MockHttpServletRequestBuilder`
Merges the properties of the "parent" RequestBuilder accepting values only if not already set in "this" instance.

Specified by:
  `merge` in interface `Mergeable`
Overrides:
  `merge` in class `MockHttpServletRequestBuilder`
Parameters:
  `parent` - the parent `RequestBuilder` to inherit properties from
Returns:
  the result of the merge

#### createServletRequest

    protected final MockHttpServletRequest createServletRequest(ServletContext servletContext)

Description copied from class: `MockHttpServletRequestBuilder`
Creates a new `MockHttpServletRequest` based on the given `ServletContext`. Can be overridden in sub-classes.

Overrides:
  `createServletRequest` in class `MockHttpServletRequestBuilder`