use of com.github.ljtfreitas.julian.http.HTTPResponse in project julian-http-client by ljtfreitas.
the class HeadersResponseTTest method compose.
@Test
void compose(@Mock ResponseFn<Void, Void> fn, @Mock HTTPResponse<Void> response) {
Arguments arguments = Arguments.empty();
Headers headers = Headers.create(new Header("X-Header", "x-header-content"));
when(response.headers()).thenReturn(headers.all().stream().reduce(HTTPHeaders.empty(), (a, b) -> a.join(new HTTPHeader(b.name(), b.values())), (a, b) -> b));
when(response.cast(notNull())).thenCallRealMethod();
Headers actual = responseT.bind(endpoint, fn).join(Promise.done(response), arguments);
assertThat(actual, contains(headers.all().toArray()));
}
Aggregations