### Question:
HttpHeaders implements Iterable<HttpHeader> { public boolean contains(CharSequence name) { return nettyHeaders.contains(name); } private  HttpHeaders(Builder builder); Set<String> names(); Optional<String> get(CharSequence name); List<String> getAll(CharSequence name); boolean contains(CharSequence name); @Override Iterator<HttpHeader> iterator(); void forEach(BiConsumer<String, String> consumer); Builder newBuilder(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void checksWhetherHeadersExist() { assertThat(headers.contains("header1"), is(true)); assertThat(headers.contains("header2"), is(true)); assertThat(headers.contains("nonExistent"), is(false)); }
@Test public void setsHeaders() { HttpHeaders newHeaders = new HttpHeaders.Builder() .add("foo", "bar") .build(); HttpHeaders headers = new HttpHeaders.Builder(newHeaders) .build(); assertThat(headers, contains(header("foo", "bar"))); }
@Test public void removesNullValues() { HttpHeaders headers = new Builder() .add("header1", asList("val1", null, "val2")) .build(); assertThat(headers, contains(header("header1", "val1"), header("header1", "val2"))); }