### Question:
HashResponseHeaders extends HashParameters implements ResponseHeaders { @Override public void addCookie(String name, String value) { add(Http.Header.SET_COOKIE, SetCookie.create(name, value).toString()); } HashResponseHeaders(BareResponse bareResponse); @Override List<MediaType> acceptPatches(); @Override void addAcceptPatches(MediaType... acceptableMediaTypes); @Override Optional<MediaType> contentType(); @Override void contentType(MediaType contentType); @Override OptionalLong contentLength(); @Override void contentLength(long contentLength); @Override Optional<ZonedDateTime> expires(); @Override void expires(ZonedDateTime dateTime); @Override void expires(Instant dateTime); @Override Optional<ZonedDateTime> lastModified(); @Override void lastModified(ZonedDateTime dateTime); @Override void lastModified(Instant dateTime); @Override Optional<URI> location(); @Override void location(URI location); @Override void addCookie(String name, String value); @Override void addCookie(String name, String value, Duration maxAge); @Override void addCookie(SetCookie cookie); @Override boolean equals(Object o); @Override int hashCode(); @Override List<String> put(String key, String... values); @Override List<String> put(String key, Iterable<String> values); @Override List<String> putIfAbsent(String key, String... values); @Override List<String> putIfAbsent(String key, Iterable<String> values); @Override List<String> computeIfAbsent(String key, Function<String, Iterable<String>> values); @Override List<String> computeSingleIfAbsent(String key, Function<String, String> value); @Override void putAll(Parameters parameters); @Override void add(String key, String... values); @Override void add(String key, Iterable<String> values); @Override void addAll(Parameters parameters); @Override List<String> remove(String key); @Override void beforeSend(Consumer<ResponseHeaders> headersConsumer); @Override Single<ResponseHeaders> whenSent(); @Override Single<ResponseHeaders> send();  }### Answer:
@Test public void addCookie() { HashResponseHeaders h = new HashResponseHeaders(null); h.addCookie("foo", "bar"); h.addCookie("aaa", "bbbb", Duration.ofMinutes(10)); h.addCookie("who", "me", Duration.ofMinutes(0)); h.addCookie(SetCookie.builder("itis", "cool") .domainAndPath(URI.create("http: .expires(ZonedDateTime.of(2080, 1, 1, 0, 0, 0, 0, ZoneId.of("Z"))) .secure(true) .build()); assertThat(h.all(Http.Header.SET_COOKIE), contains("foo=bar", "aaa=bbbb; Max-Age=600", "who=me", "itis=cool; Expires=Mon, 1 Jan 2080 00:00:00 GMT; Domain=oracle.com;" + " Path=/foo; Secure")); }