### Question:
AdWordsAxisHeaderHandler implements
    HeaderHandler<AdWordsSession, AdWordsServiceDescriptor> { @Override public void setHeaders(Object soapClient, AdWordsSession adWordsSession, AdWordsServiceDescriptor adWordsServiceDescriptor) throws AuthenticationException, ServiceException { try { Preconditions.checkArgument(soapClient instanceof Stub, "soapClient must be Stub but was: %s", soapClient); Stub stub = (Stub) soapClient; Object soapHeader = soapHeaderFactory.createSoapHeader(adWordsServiceDescriptor); String namespace = adWordsApiConfiguration.getNamespacePrefix() + "/" + adWordsServiceDescriptor.getPackageGroup() + "/" + adWordsServiceDescriptor.getVersion(); soapClientHandler.setHeader(stub, namespace, REQUEST_HEADER_LOCAL_PART, soapHeader); soapClientHandler.setHeaderChild(stub, REQUEST_HEADER_LOCAL_PART, "developerToken", adWordsSession.getDeveloperToken()); soapClientHandler.setHeaderChild(stub, REQUEST_HEADER_LOCAL_PART, "clientCustomerId", adWordsSession.getClientCustomerId()); soapClientHandler.setHeaderChild(stub, REQUEST_HEADER_LOCAL_PART, "userAgent", userAgentCombiner.getUserAgent(adWordsSession.getUserAgent())); soapClientHandler.setHeaderChild(stub, REQUEST_HEADER_LOCAL_PART, "validateOnly", adWordsSession.isValidateOnly()); soapClientHandler.setHeaderChild(stub, REQUEST_HEADER_LOCAL_PART, "partialFailure", adWordsSession.isPartialFailure()); soapClientHandler.setCompression(stub, adsLibConfiguration.isCompressionEnabled()); soapClientHandler.setRequestTimeout(stub, adsLibConfiguration.getSoapRequestTimeout()); authorizationHeaderHandler.setAuthorization(soapClient, adWordsSession); } catch (InstantiationException | IllegalAccessException | ServiceException | ClassNotFoundException | InvocationTargetException | NoSuchMethodException e) { throw new ServiceException( "Unexpected exception setting headers for: " + adWordsServiceDescriptor, e); } } @Inject  AdWordsAxisHeaderHandler(
      AxisHandler soapClientHandler,
      AdWordsApiConfiguration adWordsApiConfiguration,
      AdsLibConfiguration adsLibConfiguration,
      AuthorizationHeaderHandler authorizationHeaderHandler,
      UserAgentCombiner userAgentCombiner,
      AxisSoapHeaderFactory<AdWordsServiceDescriptor> soapHeaderFactory); @Override void setHeaders(Object soapClient, AdWordsSession adWordsSession,
      AdWordsServiceDescriptor adWordsServiceDescriptor);  }### Answer:
@Test public void testSetHeaders() throws Exception { Map<String, Object> expectedHeaders = Maps.newHashMap(); expectedHeaders.put("clientCustomerId", adWordsSession.getClientCustomerId()); expectedHeaders.put("developerToken", adWordsSession.getDeveloperToken()); expectedHeaders.put("validateOnly", adWordsSession.isValidateOnly()); expectedHeaders.put("userAgent", "libSig"); doNothing().when(soapClientHandler) .setHeader(eq(soapClient), anyString(), anyString(), any()); when(soapClientHandler.getHeader(eq(soapClient), anyString())).thenReturn(Maps.newHashMap()); when(soapHeaderFactory.createSoapHeader(adWordsServiceDescriptor)).thenReturn( Maps.newHashMap()); when(userAgentCombiner.getUserAgent(anyString())).thenReturn( expectedHeaders.get("userAgent").toString()); headerHandler.setHeaders(soapClient, adWordsSession, adWordsServiceDescriptor); ArgumentCaptor<String> nameCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<Object> valueCaptor = ArgumentCaptor.forClass(Object.class); verify(soapClientHandler, atLeast(expectedHeaders.size())).setHeaderChild(eq(soapClient), anyString(), nameCaptor.capture(), valueCaptor.capture()); List<String> capturedNames = nameCaptor.getAllValues(); List<Object> capturedValues = valueCaptor.getAllValues(); for (int i = 0; i < expectedHeaders.size(); i++) { String name = capturedNames.get(i); Object value = capturedValues.get(i); Object expectedValue = expectedHeaders.get(name); assertEquals("Captured value for " + name + " is incorrect", expectedValue, value); } }