### Question:
SanitisedHttpHeaderFormatter { public String format(HttpHeaders headers) { return StreamSupport.stream(headers.spliterator(), false) .map(this::hideOrFormatHeader) .collect(joining(", ")); } SanitisedHttpHeaderFormatter(List<String> headersToHide, List<String> cookiesToHide); List<String> cookiesToHide(); String format(HttpHeaders headers);  }### Answer:
@Test public void formatShouldFormatRequest() { HttpHeaders headers = new HttpHeaders.Builder() .add("header1", "a") .add("header2", "b") .add("header3", "c") .add("header4", "d") .add("COOKIE", "cookie1=e;cookie2=f;") .add("SET-COOKIE", "cookie3=g;cookie4=h;") .build(); List<String> headersToHide = Arrays.asList("HEADER1", "HEADER3"); List<String> cookiesToHide = Arrays.asList("cookie2", "cookie4"); String formattedHeaders = new SanitisedHttpHeaderFormatter(headersToHide, cookiesToHide).format(headers); assertThat(formattedHeaders, is("header1=****, header2=b, header3=****, header4=d, COOKIE=cookie1=e;cookie2=****, SET-COOKIE=cookie3=g;cookie4=****")); }