PassthroughOutboundPatientDiscoveryDeferredRequest extends AbstractOutboundPatientDiscoveryDeferredRequest { @Override public MCCIIN000002UV01 processPatientDiscoveryAsyncReq(PRPAIN201305UV02 request, AssertionType assertion, NhinTargetCommunitiesType targets) { logInfoServiceProcess(this.getClass()); auditRequest(request, PDMessageGeneratorUtils.getInstance().generateMessageId(assertion), msgUtils.convertFirstToNhinTargetSystemType(targets)); return sendToNhin(request, assertion, targets); } PassthroughOutboundPatientDiscoveryDeferredRequest();  PassthroughOutboundPatientDiscoveryDeferredRequest(PatientDiscoveryDeferredRequestAuditLogger auditLogger,
        OutboundPatientDiscoveryDeferredRequestDelegate delegate); @Override MCCIIN000002UV01 processPatientDiscoveryAsyncReq(PRPAIN201305UV02 request, AssertionType assertion,
        NhinTargetCommunitiesType targets); @Override PatientDiscoveryDeferredRequestAuditLogger getPatientDiscoveryDeferredAuditLogger();  }
@Test public void invoke() { PRPAIN201305UV02 request = new PRPAIN201305UV02(); AssertionType assertion = new AssertionType(); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); MCCIIN000002UV01 expectedResponse = new MCCIIN000002UV01(); PatientDiscoveryDeferredRequestAuditLogger auditLogger = getAuditLogger(true); OutboundPatientDiscoveryDeferredRequestDelegate delegate = mock(OutboundPatientDiscoveryDeferredRequestDelegate.class); OutboundPatientDiscoveryDeferredRequestOrchestratable returnedOrchestratable = mock(OutboundPatientDiscoveryDeferredRequestOrchestratable.class); when(returnedOrchestratable.getResponse()).thenReturn(expectedResponse); when(delegate.process(any(OutboundPatientDiscoveryDeferredRequestOrchestratable.class))).thenReturn( returnedOrchestratable); PassthroughOutboundPatientDiscoveryDeferredRequest passthroughPatientDiscovery = new PassthroughOutboundPatientDiscoveryDeferredRequest( auditLogger, delegate); MCCIIN000002UV01 actualResponse = passthroughPatientDiscovery.processPatientDiscoveryAsyncReq(request, assertion, targets); assertSame(expectedResponse, actualResponse); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME), any(PatientDiscoveryDeferredRequestAuditTransforms.class)); }
@Test public void auditOffForOutboundPDDeferredReq() { PRPAIN201305UV02 request = new PRPAIN201305UV02(); AssertionType assertion = new AssertionType(); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); MCCIIN000002UV01 expectedResponse = new MCCIIN000002UV01(); PatientDiscoveryDeferredRequestAuditLogger auditLogger = getAuditLogger(false); OutboundPatientDiscoveryDeferredRequestDelegate delegate = mock(OutboundPatientDiscoveryDeferredRequestDelegate.class); OutboundPatientDiscoveryDeferredRequestOrchestratable returnedOrchestratable = mock(OutboundPatientDiscoveryDeferredRequestOrchestratable.class); when(returnedOrchestratable.getResponse()).thenReturn(expectedResponse); when(delegate.process(any(OutboundPatientDiscoveryDeferredRequestOrchestratable.class))).thenReturn( returnedOrchestratable); PassthroughOutboundPatientDiscoveryDeferredRequest passthroughPatientDiscovery = new PassthroughOutboundPatientDiscoveryDeferredRequest( auditLogger, delegate); MCCIIN000002UV01 actualResponse = passthroughPatientDiscovery.processPatientDiscoveryAsyncReq(request, assertion, targets); assertSame(expectedResponse, actualResponse); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, never()).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.PATIENT_DISCOVERY_DEFERRED_REQ_SERVICE_NAME), any(PatientDiscoveryDeferredRequestAuditTransforms.class)); }