A Test client that can be used in unit tests to verify requests and stub responses.
Example:
TestRxRestDatastoreClient client = new TestRxRestDatastoreClient(Person)
def mock = client.expect {
uriTemplate '/person/1'
}
.respond {
json {
id 1
name "Fred"
age 10
dateOfBirth "2006-07-09T00:00+0000"
}
}
Person p = Person.get(1).toBlocking().first()
mock.verify()
Fields inherited from class | Fields |
---|---|
class RxRestDatastoreClient |
allowBlockingOperations |
class AbstractRxDatastoreClient |
mappingContext |
Constructor and description |
---|
TestRxRestDatastoreClient
(org.springframework.core.env.PropertyResolver configuration, java.lang.Class... classes) |
TestRxRestDatastoreClient
(java.lang.Class... classes) |
TestRxRestDatastoreClient
(java.lang.Iterable<java.lang.String> connectionSourceNames, org.springframework.core.env.PropertyResolver configuration, java.lang.Class... classes) |
TestRxRestDatastoreClient
(java.lang.Iterable<java.lang.String> connectionSourceNames, java.lang.Class... classes) |
protected TestRxRestDatastoreClient
(ConnectionSources<io.reactivex.netty.client.ConnectionProviderFactory, RestConnectionSourceSettings> connectionSources, java.lang.Class... classes) |
protected TestRxRestDatastoreClient
(ConnectionSources<io.reactivex.netty.client.ConnectionProviderFactory, RestConnectionSourceSettings> connectionSources, RestClientMappingContext mappingContext) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected RxRestDatastoreClient |
createChildClient(SingletonConnectionSources<io.reactivex.netty.client.ConnectionProviderFactory, RestConnectionSourceSettings> singletonConnectionSources) |
|
TestHttpServerRequestBuilder |
expect(groovy.lang.Closure callable) Add expectations |
|
TestRxRestDatastoreClient |
getDatastoreClient(java.lang.String connectionSourceName) |
|
HttpTestServer |
getHttpTestServer() |
|
protected static ConnectionSources<io.reactivex.netty.client.ConnectionProviderFactory, RestConnectionSourceSettings> |
initializeConnectionSources(java.lang.Iterable<java.lang.String> connectionSourceNames, org.springframework.core.env.PropertyResolver configuration) |
|
void |
reset() Reset the state of the mock |
Add expectations
callable
- The callableReset the state of the mock