Class MockServerWebExchange
java.lang.Object
org.springframework.web.server.adapter.DefaultServerWebExchange
org.springframework.mock.web.server.MockServerWebExchange
- All Implemented Interfaces:
ServerWebExchange
Extension of
DefaultServerWebExchange
for use in tests, along with
MockServerHttpRequest
and MockServerHttpResponse
.
See static factory methods to create an instance.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
-
Field Summary
Fields inherited from interface org.springframework.web.server.ServerWebExchange
LOG_ID_ATTRIBUTE
-
Method Summary
Modifier and TypeMethodDescriptionbuilder
(MockServerHttpRequest request) Create aMockServerWebExchange.Builder
starting with the given mock request.builder
(MockServerHttpRequest.BaseBuilder<?> requestBuilder) Variant ofbuilder(MockServerHttpRequest)
with a mock request builder.static MockServerWebExchange
from
(MockServerHttpRequest request) Create aMockServerWebExchange
from the given mock request.static MockServerWebExchange
from
(MockServerHttpRequest.BaseBuilder<?> requestBuilder) Variant offrom(MockServerHttpRequest)
with a mock request builder.Return the current HTTP response.Methods inherited from class org.springframework.web.server.adapter.DefaultServerWebExchange
addUrlTransformer, checkNotModified, checkNotModified, checkNotModified, cleanupMultipart, getApplicationContext, getAttributes, getFormData, getLocaleContext, getLogPrefix, getMultipartData, getPrincipal, getRequest, getSession, isNotModified, transformUrl
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.server.ServerWebExchange
getAttribute, getAttributeOrDefault, getRequiredAttribute, mutate
-
Method Details
-
getResponse
Description copied from interface:ServerWebExchange
Return the current HTTP response.- Specified by:
getResponse
in interfaceServerWebExchange
- Overrides:
getResponse
in classDefaultServerWebExchange
-
from
Create aMockServerWebExchange
from the given mock request.- Parameters:
request
- the request to use.- Returns:
- the exchange
-
from
Variant offrom(MockServerHttpRequest)
with a mock request builder.- Parameters:
requestBuilder
- the builder for the mock request.- Returns:
- the exchange
-
builder
Create aMockServerWebExchange.Builder
starting with the given mock request.- Parameters:
request
- the request to use.- Returns:
- the exchange builder
- Since:
- 5.1
-
builder
public static MockServerWebExchange.Builder builder(MockServerHttpRequest.BaseBuilder<?> requestBuilder) Variant ofbuilder(MockServerHttpRequest)
with a mock request builder.- Parameters:
requestBuilder
- the builder for the mock request.- Returns:
- the exchange builder
- Since:
- 5.1
-