use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class JaxWsHandlerTest method testInvokeSoapCall.
@Test
public void testInvokeSoapCall() throws SecurityException, NoSuchMethodException {
CampaignServiceInterface soapClient = new CampaignServiceInterfaceImpl();
Method soapCallMethod = CampaignServiceInterface.class.getMethod("getTestMessage", new Class<?>[0]);
SoapCall<BindingProvider> soapCall = new SoapCall<BindingProvider>(soapCallMethod, soapClient, new Object[0]);
RemoteCallReturn returnedValue = jaxWsHandler.invokeSoapCall(soapCall);
assertEquals("Here!", returnedValue.getReturnValue());
assertEquals(null, returnedValue.getException());
assertEquals(CampaignServiceInterfaceImpl.endpointAddress, returnedValue.getRequestInfo().getUrl());
}
use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class SoapServiceClientTest method testUnwrapRemoteCallReturn_successful.
@Test
public void testUnwrapRemoteCallReturn_successful() throws Throwable {
Object expectedReturnValue = "return";
RemoteCallReturn remoteCallReturn = new RemoteCallReturn.Builder().withReturnValue(expectedReturnValue).build();
assertEquals(expectedReturnValue, soapServiceClient.unwrapRemoteCallReturn(remoteCallReturn));
}
use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class SoapServiceClientTest method testCallSoapClient_exception.
@Test
@SuppressWarnings("unchecked")
public void testCallSoapClient_exception() {
RemoteCallReturn expectedRemoteCallReturn = new RemoteCallReturn.Builder().withException(MockSoapClient.EXCEPTION).build();
SoapCall<Object> soapCall = Mockito.mock(SoapCall.class);
when(soapClientHandler.invokeSoapCall(soapCall)).thenReturn(expectedRemoteCallReturn);
RemoteCallReturn testRemoteCallReturn = soapServiceClient.callSoapClient(soapCall);
assertSame(MockSoapClient.EXCEPTION, testRemoteCallReturn.getException());
}
use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class SoapServiceClientTest method testInvoke_soapClientMethod.
@Test
public void testInvoke_soapClientMethod() throws Throwable {
Object returnValue = new Object();
RemoteCallReturn callReturn = new RemoteCallReturn.Builder().withReturnValue(returnValue).build();
Method identityCallMethod = MockSoapClient.class.getMethod("identityCall", Object[].class);
Object[] arg = new String[] { "arg1", "arg2" };
Object[] args = new Object[] { arg };
SoapCall<Object> soapCall = new SoapCall<Object>(identityCallMethod, soapClient, args);
when(soapClientHandler.getSoapClientMethod(soapClient, identityCallMethod)).thenReturn(identityCallMethod);
when(soapClientHandler.invokeSoapCall(soapCall)).thenReturn(callReturn);
Object result = soapServiceClient.invoke(null, identityCallMethod, args);
assertEquals(returnValue, result);
}
use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class SoapServiceClientTest method testUnwrapRemoteCallReturn_exception.
@Test
public void testUnwrapRemoteCallReturn_exception() throws Throwable {
RemoteCallReturn remoteCallReturn = new RemoteCallReturn.Builder().withException(new NoSuchMethodException()).build();
thrown.expect(NoSuchMethodException.class);
soapServiceClient.unwrapRemoteCallReturn(remoteCallReturn);
}
Aggregations