-
- All Implemented Interfaces:
-
org.springframework.test.web.client.ResponseCreator
public final class JSONMockServerDSL implements ResponseCreatorA DSL class to assist with setting up MockRestServiceServer configurations. Instances of this class are created by the
mock,mockGetormockPostextension functions on MockRestServiceServer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classJSONMockServerDSL.Responsepublic classJSONMockServerDSL.Companion
-
Method Summary
Modifier and Type Method Description final UnitrequestTo(String expectedURI)final UnitrequestTo(URI expectedURI)final UnitrequestTo(Function1<String, Boolean> test)final UnitrequestTo(Matcher<in String> matcher)final Unitmethod(HttpMethod method)final UnitqueryParam(String name, String expectedValues)final Unitheader(String name, String expectedValues)final Unitheader(String name, Function1<String, Boolean> test)final Unitheader(String name, Matcher<in String> matchers)final Unitaccept(MediaType expectedMediaType)final UnitacceptApplicationJSON()final UnitcontentType(MediaType expectedMediaType)final UnitcontentTypeApplicationJSON()final UnitheaderDoesNotExist(String name)final UnitrequestContent(String body)final UnitrequestContent(Function1<String, Boolean> test)final UnitrequestJSON(Function1<JSONExpect, Unit> tests)final UnitrespondJSON(HttpStatus status, HttpHeaders headers, Function1<JSONMockClientRequest, Object> lambda)final UnitrespondJSON(HttpStatus status, HttpHeaders headers, Object result)final Unitrespond(HttpStatus status, HttpHeaders headers, MediaType contentType, String result)final UnitrespondTextPlain(HttpStatus status, HttpHeaders headers, String result)final UnitrespondTextPlain(HttpStatus status, HttpHeaders headers, Function1<JSONMockClientRequest, String> lambda)final UnitrespondBytes(HttpStatus status, HttpHeaders headers, MediaType contentType, ByteArray result)final UnitrespondBytes(HttpStatus status, HttpHeaders headers, MediaType contentType, Function1<JSONMockClientRequest, ByteArray> lambda)ClientHttpResponsecreateResponse(ClientHttpRequest request)-
-
Method Detail
-
requestTo
@Deprecated(message = "The use of Matcher will be removed in a future version", replaceWith = @ReplaceWith(imports = {}, expression = "requestTo { test(it) }")) final Unit requestTo(Matcher<in String> matcher)
-
queryParam
final Unit queryParam(String name, String expectedValues)
-
header
@Deprecated(message = "The use of Matcher will be removed in a future version", replaceWith = @ReplaceWith(imports = {}, expression = "header(name) { test(it) }")) final Unit header(String name, Matcher<in String> matchers)
-
acceptApplicationJSON
final Unit acceptApplicationJSON()
-
contentType
final Unit contentType(MediaType expectedMediaType)
-
contentTypeApplicationJSON
final Unit contentTypeApplicationJSON()
-
headerDoesNotExist
final Unit headerDoesNotExist(String name)
-
requestContent
final Unit requestContent(String body)
-
requestContent
final Unit requestContent(Function1<String, Boolean> test)
-
requestJSON
final Unit requestJSON(Function1<JSONExpect, Unit> tests)
-
respondJSON
final Unit respondJSON(HttpStatus status, HttpHeaders headers, Function1<JSONMockClientRequest, Object> lambda)
-
respondJSON
final Unit respondJSON(HttpStatus status, HttpHeaders headers, Object result)
-
respond
final Unit respond(HttpStatus status, HttpHeaders headers, MediaType contentType, String result)
-
respondTextPlain
final Unit respondTextPlain(HttpStatus status, HttpHeaders headers, String result)
-
respondTextPlain
final Unit respondTextPlain(HttpStatus status, HttpHeaders headers, Function1<JSONMockClientRequest, String> lambda)
-
respondBytes
final Unit respondBytes(HttpStatus status, HttpHeaders headers, MediaType contentType, ByteArray result)
-
respondBytes
final Unit respondBytes(HttpStatus status, HttpHeaders headers, MediaType contentType, Function1<JSONMockClientRequest, ByteArray> lambda)
-
createResponse
ClientHttpResponse createResponse(ClientHttpRequest request)
-
-
-
-