### Question:
JaxWsHandler extends SoapClientHandler<BindingProvider> { @Override public BindingProvider createSoapClient(SoapServiceDescriptor soapServiceDescriptor) throws ServiceException { try { if (soapServiceDescriptor instanceof JaxWsCompatible) { JaxWsCompatible jaxWsCompatibleService = (JaxWsCompatible) soapServiceDescriptor; Object portLocator = jaxWsCompatibleService.getServiceClass() .getConstructor(new Class[0]).newInstance(new Object[0]); String interfaceClassName = soapServiceDescriptor.getInterfaceClass().getSimpleName(); BindingProvider soapClient = (BindingProvider) portLocator.getClass() .getMethod("get" + interfaceClassName + "Port").invoke(portLocator); setConnectTimeout(soapClient); @SuppressWarnings("rawtypes") List<Handler> bindings = soapClient.getBinding().getHandlerChain(); bindings.add(contextHandlerProvider.get()); soapClient.getBinding().setHandlerChain(bindings); return soapClient; } throw new ServiceException( "Service [" + soapServiceDescriptor + "] is not compatible with JAX-WS", null); } catch (SecurityException e) { throw new ServiceException("Unexpected Exception.", e); } catch (NoSuchMethodException e) { throw new ServiceException("Unexpected Exception.", e); } catch (IllegalArgumentException e) { throw new ServiceException("Unexpected Exception.", e); } catch (IllegalAccessException e) { throw new ServiceException("Unexpected Exception.", e); } catch (InvocationTargetException e) { throw new ServiceException("Unexpected Exception.", e.getCause()); } catch (ClassNotFoundException e) { throw new ServiceException("Unexpected Exception.", e); } catch (InstantiationException e) { throw new ServiceException("Unexpected Exception.", e); } } @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 testCreateSoapClient() { SoapServiceDescriptor serviceDescriptor = new MockJaxWsCompatibleDescriptor(); BindingProvider provider = jaxWsHandler.createSoapClient(serviceDescriptor); assertTrue(provider instanceof CampaignServiceInterfaceImpl); assertTrue(provider.getBinding().getHandlerChain().get(0) instanceof JaxWsSoapContextHandler); }
@Test public void testCreateSoapClient_notJaxWsCompatible() { thrown.expect(ServiceException.class); jaxWsHandler.createSoapClient(Mockito.mock(SoapServiceDescriptor.class)); }