NhinCallableRequest implements Callable<Response> { @Override public Response call() { WebServiceContextImpl.setMessageContext(context); Response response; try { if (client != null) { response = (Response) client.process(entityRequest); if (response == null) { throw new Exception("Response received is null!!!"); } } else { throw new Exception("NhinDelegate is null!!!"); } } catch (Exception e) { LOG.error("Failed to process callable request.", e); response = (Response) processor.processErrorResponse(entityRequest, e.getMessage()); } return response; } NhinCallableRequest(OutboundOrchestratableMessage orch); @Override Response call();  }
@Test public void testCall() { System.out.println("call"); TestOutboundOrchestratableMessage test = new TestOutboundOrchestratableMessage(); NhinCallableRequest<OutboundOrchestratableMessage> instance = new NhinCallableRequest<>(test); Object result = instance.call(); assertNotNull(result); }
@Test(expected = Exception.class) public void testCallWithNullResponse() { System.out.println("call"); TestOutboundOrchestratableMessage test = new TestOutboundOrchestratableMessage(); test.setReturnNullObject(true); NhinCallableRequest<OutboundOrchestratableMessage> instance = new NhinCallableRequest<>(test); Object result = instance.call(); }
@Test(expected = Exception.class) public void testCallWithNullClient() { System.out.println("call"); TestOutboundOrchestratableMessage test = new TestOutboundOrchestratableMessage(); test.setReturnNullOutboundDelegate(true); NhinCallableRequest<OutboundOrchestratableMessage> instance = new NhinCallableRequest<>(test); Object result = instance.call(); }