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