NhinPatientDiscoveryDeferredReqProxyWebServiceSecuredImpl implements NhinPatientDiscoveryDeferredReqProxy { @NwhinInvocationEvent(beforeBuilder = PRPAIN201305UV02EventDescriptionBuilder.class, afterReturningBuilder = MCCIIN000002UV01EventDescriptionBuilder.class, serviceType = "Patient Discovery Deferred Request", version = "1.0") @Override public MCCIIN000002UV01 respondingGatewayPRPAIN201305UV02(PRPAIN201305UV02 request, AssertionType assertion, NhinTargetSystemType target) { String url; String ackMessage; MCCIIN000002UV01 response = new MCCIIN000002UV01(); try { if (request != null) { LOG.debug("Before target system URL look up."); url = oProxyHelper.getUrlFromTargetSystemByGatewayAPILevel(target, NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME, GATEWAY_API_LEVEL.LEVEL_g0); LOG.debug("After target system URL look up. URL for service: {} is: {}", NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME, url); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<RespondingGatewayDeferredRequestPortType> portDescriptor = new RespondingGatewayDeferredRequestServicePortDescriptor(); CONNECTClient<RespondingGatewayDeferredRequestPortType> client = getCONNECTSecuredClient( portDescriptor, assertion, url, target); response = (MCCIIN000002UV01) client.invokePort(RespondingGatewayDeferredRequestPortType.class, "respondingGatewayDeferredPRPAIN201305UV02", request); } else { throw new WebServiceException("Could not determine URL for Patient Discovery Deferred Request endpoint"); } } else { throw new IllegalArgumentException("Request Message must be provided"); } } catch (Exception e) { ackMessage = "Failed to call the web service (" + NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME + "). An unexpected exception occurred."; response = HL7AckTransforms.createAckErrorFrom201305(request, ackMessage); throw new ErrorEventException(e, response, "Unable to call Nhin Patient Discovery Deferred Request"); } return response; }  @NwhinInvocationEvent(beforeBuilder = PRPAIN201305UV02EventDescriptionBuilder.class, afterReturningBuilder = MCCIIN000002UV01EventDescriptionBuilder.class, serviceType = "Patient Discovery Deferred Request", version = "1.0") @Override MCCIIN000002UV01 respondingGatewayPRPAIN201305UV02(PRPAIN201305UV02 request, AssertionType assertion,
            NhinTargetSystemType target);  }
@Test public void testNoMtom() throws Exception { NhinPatientDiscoveryDeferredReqProxyWebServiceSecuredImpl impl = getImpl(); Field helper = ReflectionUtils.findField(NhinPatientDiscoveryDeferredReqProxyWebServiceSecuredImpl.class, "oProxyHelper"); ReflectionUtils.makeAccessible(helper); WebServiceProxyHelper helperMock = mock(WebServiceProxyHelper.class); Mockito.when(helperMock.getUrlFromTargetSystemByGatewayAPILevel(target, NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME, GATEWAY_API_LEVEL.LEVEL_g0)).thenReturn("Localhost"); ReflectionUtils.setField(helper, impl, helperMock); impl.respondingGatewayPRPAIN201305UV02(request, assertion, target); verify(client, never()).enableMtom(); }