@Test public void shouldGetCookies() { ResponseCookie simpleCookie = ResponseCookie.from("key2", "value2") .build(); ResponseCookie complexCookie = ResponseCookie.from("key1", "value1") .domain("domain") .httpOnly(true) .maxAge(1) .path("path") .secure(true) .build(); given(mockDelegate.cookies()).willReturn( Arrays.asList(simpleCookie.toString(), complexCookie.toString())); MultiValueMap<String, ResponseCookie> expectedCookies = new LinkedMultiValueMap<>(); expectedCookies.add(simpleCookie.getName(), simpleCookie); expectedCookies.add(complexCookie.getName(), complexCookie); VertxClientHttpResponse response = new VertxClientHttpResponse(mockDelegate, Flux.empty()); MultiValueMap<String, ResponseCookie> actualCookies = response.getCookies(); assertThat(actualCookies).isEqualTo(expectedCookies); }
@Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> cookies = new LinkedMultiValueMap<>(); delegate.cookies() .stream() .map(CookieConverter::toResponseCookies) .flatMap(Collection::stream) .forEach(cookie -> cookies.add(cookie.getName(), cookie)); return cookies; }
VertxClientHttpResponse implements ClientHttpResponse { @Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> cookies = new LinkedMultiValueMap<>(); delegate.cookies() .stream() .map(CookieConverter::toResponseCookies) .flatMap(Collection::stream) .forEach(cookie -> cookies.add(cookie.getName(), cookie)); return cookies; } }
VertxClientHttpResponse implements ClientHttpResponse { @Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> cookies = new LinkedMultiValueMap<>(); delegate.cookies() .stream() .map(CookieConverter::toResponseCookies) .flatMap(Collection::stream) .forEach(cookie -> cookies.add(cookie.getName(), cookie)); return cookies; } VertxClientHttpResponse(HttpClientResponse delegate, Flux<DataBuffer> body); }
VertxClientHttpResponse implements ClientHttpResponse { @Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> cookies = new LinkedMultiValueMap<>(); delegate.cookies() .stream() .map(CookieConverter::toResponseCookies) .flatMap(Collection::stream) .forEach(cookie -> cookies.add(cookie.getName(), cookie)); return cookies; } VertxClientHttpResponse(HttpClientResponse delegate, Flux<DataBuffer> body); @Override int getRawStatusCode(); @Override HttpStatus getStatusCode(); @Override Flux<DataBuffer> getBody(); @Override HttpHeaders getHeaders(); @Override MultiValueMap<String, ResponseCookie> getCookies(); }
VertxClientHttpResponse implements ClientHttpResponse { @Override public MultiValueMap<String, ResponseCookie> getCookies() { MultiValueMap<String, ResponseCookie> cookies = new LinkedMultiValueMap<>(); delegate.cookies() .stream() .map(CookieConverter::toResponseCookies) .flatMap(Collection::stream) .forEach(cookie -> cookies.add(cookie.getName(), cookie)); return cookies; } VertxClientHttpResponse(HttpClientResponse delegate, Flux<DataBuffer> body); @Override int getRawStatusCode(); @Override HttpStatus getStatusCode(); @Override Flux<DataBuffer> getBody(); @Override HttpHeaders getHeaders(); @Override MultiValueMap<String, ResponseCookie> getCookies();  }