### Question:
JaxWsHandler extends SoapClientHandler<BindingProvider> { @Override public void clearHeaders(BindingProvider soapClient) { getContextHandlerFromClient(soapClient).clearHeaders(); soapClient.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, new HashMap<String, List<String>>()); } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); @Override void setEndpointAddress(BindingProvider soapClient, String endpointAddress); @Override Object getHeader(BindingProvider soapClient, String headerName); @Override void clearHeaders(BindingProvider soapClient); @Override void setHeader(BindingProvider soapClient, String namespace, String headerName,
      Object headerValue); void setHeaderChildString(BindingProvider soapClient, final String headerName,
      String childNamespace, String childName, String childValue); @Override void putAllHttpHeaders(BindingProvider soapClient, Map<String, String> headersMap); @Override void setCompression(BindingProvider soapClient, boolean compress); @Override BindingProvider createSoapClient(SoapServiceDescriptor soapServiceDescriptor); @Override void setRequestTimeout(BindingProvider bindingProvider, int timeout); @Override RemoteCallReturn invokeSoapCall(SoapCall<BindingProvider> soapCall); @Override String getEndpointAddress(BindingProvider soapClient); @Override SOAPHeaderElement createSoapHeaderElement(QName qName);  }### Answer:
@Test public void testClearHeaders() { SOAPElement header1 = Mockito.mock(SOAPElement.class); SOAPElement header2 = Mockito.mock(SOAPElement.class); contextHandler.addHeader(null, null, header1); contextHandler.addHeader(null, null, header2); assertFalse(new HashSet<SOAPElement>().equals(contextHandler.getAddedHeaders())); when(mockSoapClient.getBinding()).thenReturn(mockBinding); when(mockBinding.getHandlerChain()).thenReturn(handlerChain); when(mockSoapClient.getRequestContext()).thenReturn(mockRequestContext); jaxWsHandler.clearHeaders(mockSoapClient); assertEquals(new HashSet<SOAPElement>(), contextHandler.getAddedHeaders()); verify(mockRequestContext).put( MessageContext.HTTP_REQUEST_HEADERS, new HashMap<String, List<String>>()); }