CallableRequest implements Callable<Response> { @Override public Response call() throws Exception { WebServiceContextImpl.setMessageContext(context); Response response; try { if (request != null) { response = (Response) client.callWebService(target, request); if (response == null) { throw new Exception("Response received is null!!!"); } } else { throw new Exception("Request is null!!!"); } } catch (Exception e) { LOG.trace("Exception making service call: {}", e.getLocalizedMessage(), e); response = (Response) new ResponseWrapper(target, request, processor.processError(e.getLocalizedMessage(), request, target)); } return response; } CallableRequest(Target t, Request r, ResponseProcessor p, WebServiceClient c); Request getRequest(); Target getTarget(); @Override Response call();  }
@Test public void testCall() throws Exception { System.out.println("call"); RespondingGatewayPRPAIN201305UV02RequestType request = new RespondingGatewayPRPAIN201305UV02RequestType(); TestClient testClient = new TestClient(); CallableRequest<UrlInfo, RespondingGatewayPRPAIN201305UV02RequestType, ResponseWrapper> instance = new CallableRequest<>( null, request, null, testClient); ResponseWrapper rw = new ResponseWrapper(); Object result = instance.call(); assertNotNull(result); }
@Test(expected = Exception.class) public void testCallWithRequestNull() throws Exception { System.out.println("testCallWithRequestNull"); CallableRequest<UrlInfo, RespondingGatewayPRPAIN201305UV02RequestType, ResponseWrapper> instance = new CallableRequest<>( null, null, null, null); Object result = instance.call(); }
@Test(expected = Exception.class) public void testCallWithResponseNull() throws Exception { System.out.println("testCallWithResponseNull"); TestClient testClient = new TestClient(); testClient.setReturnResponseNull(true); RespondingGatewayPRPAIN201305UV02RequestType request = new RespondingGatewayPRPAIN201305UV02RequestType(); CallableRequest<UrlInfo, RespondingGatewayPRPAIN201305UV02RequestType, ResponseWrapper> instance = new CallableRequest<>( null, request, null, testClient); Object result = instance.call(); }