Allows for mocking and testing usages of RxHttpClientBuilder in application code
Below is an example:
TestRxHttpClientBuilder client = new TestRxHttpClientBuilder()
client.expect {
uri '/foo/bar'
method "POST"
contentType 'application/json'
json {
title "Ping"
}
}.respond {
created()
json {
title "Pong"
}
}
Observable p = client.post("https://localhost:8080/foo/bar") {
contentType 'application/json'
json {
title "Ping"
}
}
assert client.verify()
| Type | Name and description |
|---|---|
HttpTestServer |
currentServer |
| Constructor and description |
|---|
TestRxHttpClientBuilder
(Configuration configuration = new DefaultConfiguration() |
| Type | Name and description |
|---|---|
void |
close() |
TestHttpServerRequestBuilder |
expect(java.lang.String server, groovy.lang.Closure expectedRequest)Adds a new request expectation |
TestHttpServerRequestBuilder |
expect(groovy.lang.Closure expectedRequest)Adds a new request expectation on a ephemeral port |
| Methods inherited from class | Name |
|---|---|
class RxHttpClientBuilder |
buildSslContext, buildSslContext, close, customizeRequest, delete, doRequest, get, head, options, patch, post, put |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Adds a new request expectation
expectedRequest - The expected requestAdds a new request expectation on a ephemeral port
expectedRequest - The expected request