@Test public void testGetServiceClient() { String version = "v1.1"; when(adsServiceClientFactoryHelper.determineVersion(MockSoapClientInterface.class)) .thenReturn(version); when( adsServiceClientFactoryHelper.createServiceDescriptor( MockSoapClientInterface.class, version)).thenReturn(adsServiceDescriptor); when(adsServiceClientFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession)) .thenReturn(adsServiceClient); Mockito.<Class<?>>when(adsServiceDescriptor.getInterfaceClass()) .thenReturn(MockSoapClientInterface.class); when(adsServiceClient.getSoapClient()).thenReturn(soapServiceClient); MockSoapClientInterface mockSoapClientInterface = adsServiceClientFactory.getServiceClient(adsSession, MockSoapClientInterface.class); assertNotNull("Null mock interface returned from getServiceClient", mockSoapClientInterface); }
public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass) throws ServiceException { adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass); String version = adsServiceFactoryHelper.determineVersion(interfaceClass); D adsServiceDescriptor = adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version); C adsServiceClient = adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession); return createProxy(interfaceClass, adsServiceClient); }
AdsServiceClientFactory { public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass) throws ServiceException { adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass); String version = adsServiceFactoryHelper.determineVersion(interfaceClass); D adsServiceDescriptor = adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version); C adsServiceClient = adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession); return createProxy(interfaceClass, adsServiceClient); } }
AdsServiceClientFactory { public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass) throws ServiceException { adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass); String version = adsServiceFactoryHelper.determineVersion(interfaceClass); D adsServiceDescriptor = adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version); C adsServiceClient = adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession); return createProxy(interfaceClass, adsServiceClient); } @SuppressWarnings("unchecked") /* Guice binding for AdsServiceClientFactoryHelper does not * include type arguments because AdsServiceClientFactoryHelper * is bound in the SOAP toolkit-agnostic AdsSoapModule module. * Therefore, must use the raw type here. */ @Inject  AdsServiceClientFactory(
      @SuppressWarnings("rawtypes") /* See note above for an explanation of why suppressing
                                     * this warning is necessary. */
      AdsServiceClientFactoryHelper adsServiceClientFactoryHelper); }
AdsServiceClientFactory { public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass) throws ServiceException { adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass); String version = adsServiceFactoryHelper.determineVersion(interfaceClass); D adsServiceDescriptor = adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version); C adsServiceClient = adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession); return createProxy(interfaceClass, adsServiceClient); } @SuppressWarnings("unchecked") /* Guice binding for AdsServiceClientFactoryHelper does not * include type arguments because AdsServiceClientFactoryHelper * is bound in the SOAP toolkit-agnostic AdsSoapModule module. * Therefore, must use the raw type here. */ @Inject  AdsServiceClientFactory(
      @SuppressWarnings("rawtypes") /* See note above for an explanation of why suppressing
                                     * this warning is necessary. */
      AdsServiceClientFactoryHelper adsServiceClientFactoryHelper); synchronized T getServiceClient(S adsSession, Class<T> interfaceClass); }
AdsServiceClientFactory { public synchronized <T> T getServiceClient(S adsSession, Class<T> interfaceClass) throws ServiceException { adsServiceFactoryHelper.checkServiceClientPreconditions(adsSession, interfaceClass); String version = adsServiceFactoryHelper.determineVersion(interfaceClass); D adsServiceDescriptor = adsServiceFactoryHelper.createServiceDescriptor(interfaceClass, version); C adsServiceClient = adsServiceFactoryHelper.createAdsServiceClient(adsServiceDescriptor, adsSession); return createProxy(interfaceClass, adsServiceClient); } @SuppressWarnings("unchecked") /* Guice binding for AdsServiceClientFactoryHelper does not * include type arguments because AdsServiceClientFactoryHelper * is bound in the SOAP toolkit-agnostic AdsSoapModule module. * Therefore, must use the raw type here. */ @Inject  AdsServiceClientFactory(
      @SuppressWarnings("rawtypes") /* See note above for an explanation of why suppressing
                                     * this warning is necessary. */
      AdsServiceClientFactoryHelper adsServiceClientFactoryHelper); synchronized T getServiceClient(S adsSession, Class<T> interfaceClass);  }