use of com.github.ljtfreitas.julian.DefaultResponseT in project julian-http-client by ljtfreitas.
the class CompletableResponseTTest method bind.
@Test
void bind() {
Promise<Response<Void>> response = new SinglePromise<>(Single.just(Response.done(null)));
ResponseFn<Void, Response<Object>> fn = new DefaultResponseT().bind(endpoint, new ObjectResponseT<>().bind(endpoint, null));
Completable completable = subject.bind(endpoint, fn).join(response, Arguments.empty());
TestObserver<Void> observer = new TestObserver<>();
completable.subscribe(observer);
observer.assertComplete().assertNoErrors();
}
use of com.github.ljtfreitas.julian.DefaultResponseT in project julian-http-client by ljtfreitas.
the class HTTPResponseTTest method compose.
@Test
void compose() {
Promise<HTTPResponse<String>> promise = Promise.done(HTTPResponse.success(HTTPStatus.valueOf(HTTPStatusCode.OK), HTTPHeaders.empty(), "hello"));
ResponseFn<String, Response<Object>> fn = new DefaultResponseT().bind(endpoint, new ObjectResponseT<>().bind(endpoint, null));
HTTPResponse<Object> actual = responseT.bind(endpoint, fn).join(promise, Arguments.empty());
assertEquals("hello", actual.body().unsafe());
}
Aggregations