Package org.springframework.test.web.servlet.assertj

# Class MockMvcTester.MockMultipartMvcRequestBuilder

java.lang.Object
org.springframework.test.web.servlet.request.AbstractMockHttpServletRequestBuilder<B>
org.springframework.test.web.servlet.request.AbstractMockMultipartHttpServletRequestBuilder<MockMvcTester.MockMultipartMvcRequestBuilder>
org.springframework.test.web.servlet.assertj.MockMvcTester.MockMultipartMvcRequestBuilder

All Implemented Interfaces:
  `org.assertj.core.api.AssertProvider<MvcTestResultAssert>`, `org.springframework.beans.Mergeable`, `ConfigurableSmartRequestBuilder<MockMvcTester.MockMultipartMvcRequestBuilder>`, `RequestBuilder`, `SmartRequestBuilder`

Enclosing class:
  MockMvcTester

public final class MockMvcTester.MockMultipartMvcRequestBuilder extends AbstractMockMultipartHttpServletRequestBuilder<MockMvcTester.MockMultipartMvcRequestBuilder> implements org.assertj.core.api.AssertProvider<MvcTestResultAssert>
A builder for `MockMultipartHttpServletRequest` that supports AssertJ.

## Method Summary

Modifier and Type
Method
Description
`MvcTestResultAssert`
`assertThat()`
`MvcTestResult`
`asyncExchange()`
Execute the request and do not attempt to wait for the completion of an asynchronous request.
`MvcTestResult`
`exchange()`
Execute the request.
`MvcTestResult`
`exchange(Duration timeToWait)`
Execute the request and wait at most the given `timeToWait` duration for the asynchronous request to complete.

### Methods inherited from class org.springframework.test.web.servlet.request.AbstractMockMultipartHttpServletRequestBuilder

`createServletRequest, file, file, merge, part`

### Methods inherited from class org.springframework.test.web.servlet.request.AbstractMockHttpServletRequestBuilder

`accept, accept, buildRequest, characterEncoding, characterEncoding, content, content, contentType, contentType, contextPath, cookie, flashAttr, flashAttrs, formField, formFields, header, headers, isMergeEnabled, locale, locale, param, params, pathInfo, postProcessRequest, principal, queryParam, queryParams, remoteAddress, requestAttr, secure, self, servletPath, session, sessionAttr, sessionAttrs, uri, uri, with`

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

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

## Method Details

### exchange

public MvcTestResult exchange()
Execute the request. If the request is processing asynchronously, wait at most the given timeout value associated with the async request, see `MockAsyncContext.setTimeout(long)`.

For simple assertions, you can wrap this builder in `assertThat` rather than calling this method explicitly:

     // These two examples are equivalent
     assertThat(mvc.get().uri("/greet")).hasStatusOk();
     assertThat(mvc.get().uri("/greet").exchange()).hasStatusOk();

For assertions on the original asynchronous request that might still be in progress, use `asyncExchange()`.

See Also:
  - `to customize the timeout for async requests`

### exchange

public MvcTestResult exchange(Duration timeToWait)
Execute the request and wait at most the given `timeToWait` duration for the asynchronous request to complete. If the request is not asynchronous, the `timeToWait` is ignored.

For assertions on the original asynchronous request that might still be in progress, use `asyncExchange()`.

See Also:
  - `exchange()`

### asyncExchange

public MvcTestResult asyncExchange()
Execute the request and do not attempt to wait for the completion of an asynchronous request. Contrary to `exchange()`, this returns the original result that might still be in progress.

### assertThat

public MvcTestResultAssert assertThat()

Specified by:
  `assertThat` in interface `org.assertj.core.api.AssertProvider<MvcTestResultAssert>`