HeaderFilters { public static HeaderFilter replaceHeaders( final String name, final String replacement) { return replaceHeaders(singleton(name), replacement); } private  HeaderFilters(); @API(status = MAINTAINED) static HeaderFilter defaultValue(); @API(status = MAINTAINED) static HeaderFilter authorization(); static HeaderFilter replaceHeaders(
            final String name,
            final String replacement); static HeaderFilter replaceHeaders(
            final Collection<String> names,
            final String replacement); static HeaderFilter replaceCookies(
            final Predicate<String> predicate, final String replacement); static HeaderFilter replaceHeaders(
            final Predicate<String> keyPredicate,
            final String replacement); static HeaderFilter replaceHeaders(
            final BiPredicate<String, String> predicate,
            final String replacement); static HeaderFilter eachHeader(
            final BinaryOperator<String> operator); static HeaderFilter removeHeaders(
            final String... names); static HeaderFilter removeHeaders(
            final Predicate<String> predicate); static HeaderFilter removeHeaders(
            final BiPredicate<String, String> predicate);  }
@Test void replacesHeadersByName() { final HeaderFilter unit = HeaderFilters.replaceHeaders( "name"::equalsIgnoreCase, "<secret>"); final HttpHeaders actual = unit.filter(HttpHeaders.empty() .update("name", "Alice", "Bob")); assertThat(actual, hasEntry("name", Arrays.asList("<secret>", "<secret>"))); }
@Test void replacesHeadersByNameAndValue() { final HeaderFilter unit = HeaderFilters.replaceHeaders( (name, value) -> "name".equals(name) && "Alice".equals(value), "<secret>"); assertThat( unit.filter(HttpHeaders.of("name", "Alice")), hasEntry("name", singletonList("<secret>"))); assertThat( unit.filter(HttpHeaders.of("name", "Bob")), hasEntry("name", singletonList("Bob"))); }