|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.social.test.client.MockRestServiceServer
public class MockRestServiceServer
Main entry point for client-side REST testing. Typically used to test a RestTemplate
, set up
expectations on request messages, and create response messages.
MockRestServiceServer
instance by calling createServer(RestTemplate)
.
expect(RequestMatcher)
, possibly by using the default
RequestMatcher
implementations provided in RequestMatchers
(which can be statically imported).
Multiple expectations can be set up by chaining ResponseActions.andExpect(RequestMatcher)
calls.andRespond(ResponseCreator)
, possibly by using the default ResponseCreator
implementations provided in
ResponseCreators
(which can be statically imported).RestTemplate
as normal, either directly of through client code.verify()
.
Method Summary | |
---|---|
static MockRestServiceServer |
createServer(RestGatewaySupport gatewaySupport)
Creates a MockRestServiceServer instance based on the given RestGatewaySupport . |
static MockRestServiceServer |
createServer(RestTemplate restTemplate)
Creates a MockRestServiceServer instance based on the given RestTemplate . |
ResponseActions |
expect(RequestMatcher requestMatcher)
Records an expectation specified by the given RequestMatcher . |
void |
verify()
Verifies that all expectations were met. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MockRestServiceServer createServer(RestTemplate restTemplate)
MockRestServiceServer
instance based on the given RestTemplate
.
restTemplate
- the RestTemplate
public static MockRestServiceServer createServer(RestGatewaySupport gatewaySupport)
MockRestServiceServer
instance based on the given RestGatewaySupport
.
gatewaySupport
- the client class
public ResponseActions expect(RequestMatcher requestMatcher)
RequestMatcher
. Returns a ResponseActions
object
that allows for creating the response, or to set up more expectations.
requestMatcher
- the request matcher expected
public void verify()
java.lang.AssertionError
- in case of unmet expectations
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |