public class WireMockRestServiceServer extends Object
MockRestServiceServer
. In
this way using a RestTemplate
can mock the responses from a server using
WireMock JSON DSL instead of the native Java DSL.Modifier and Type | Method and Description |
---|---|
WireMockRestServiceServer |
baseUrl(String baseUrl)
Add a base url to all requests.
|
org.springframework.test.web.client.MockRestServiceServer |
build()
Build a MockRestServiceServer from the configured stubs.
|
WireMockRestServiceServer |
files(String... locations)
Add some resource locations for files that represent response bodies.
|
WireMockRestServiceServer |
ignoreExpectOrder(boolean ignoreExpectOrder)
Flag to tell the MockRestServiceServer to ignore the order of calls when matching
requests.
|
WireMockRestServiceServer |
stubs(String... locations)
Add some resource locations for stubs.
|
WireMockRestServiceServer |
suffix(String suffix)
If stub locations are given as a directory, then we search recursively in that
directory for files with this suffix.
|
static WireMockRestServiceServer |
with(org.springframework.web.client.RestTemplate restTemplate)
Public factory method for wrapping a rest template into a MockRestServiceServer.
|
public static WireMockRestServiceServer with(org.springframework.web.client.RestTemplate restTemplate)
restTemplate
- the rest template to wrappublic WireMockRestServiceServer ignoreExpectOrder(boolean ignoreExpectOrder)
ignoreExpectOrder
- flag value (default true)public WireMockRestServiceServer suffix(String suffix)
suffix
- the suffix to use when creating a resource patternpublic WireMockRestServiceServer baseUrl(String baseUrl)
baseUrl
- a base url to applypublic WireMockRestServiceServer stubs(String... locations)
**/*.json
appended, where ".json" is the value of the
suffix
). Examples:
classpath:/mappings/foo.json classpath:/mappings/*.json classpath:META-INF/com.example/stubs/1.0.0/mappings/**/*.json file:src/test/resources/stubs
locations
- a set of resource locationspublic WireMockRestServiceServer files(String... locations)
locations
- public org.springframework.test.web.client.MockRestServiceServer build()
Copyright © 2016–2017 Spring. All rights reserved.