### Question:
BasicAuthFilter extends ClientFilter { @Override public ClientResponse handle(final ClientRequest cr) throws ClientHandlerException { if (!cr.getHeaders().containsKey(HttpHeaders.AUTHORIZATION)) { cr.getHeaders().add(HttpHeaders.AUTHORIZATION, authentication); } return getNext().handle(cr); } BasicAuthFilter(final String username, final String password); @Override ClientResponse handle(final ClientRequest cr); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void test() { authFilter.handle(clientRequest); assertTrue("" + headers.get(HttpHeaders.AUTHORIZATION), headers.get(HttpHeaders.AUTHORIZATION).contains( "Basic YWRtaW46bGFtZXBhc3M=")); }
@Test public void testAuthAlreadySet() { headers.add(HttpHeaders.AUTHORIZATION, "banan"); authFilter.handle(clientRequest); assertTrue(!headers.get(HttpHeaders.AUTHORIZATION).contains( "Basic YWRtaW46bGFtZXBhc3M=")); }