PatientDiscoveryPolicyTransformHelper { public CheckPolicyRequestType transformPatientDiscoveryEntityToCheckPolicy( RespondingGatewayPRPAIN201305UV02RequestType event) { LOG.debug("Begin -- PatientDiscoveryPolicyTransformHelper.transformPatientDiscoveryEntityToCheckPolicy()"); if (event == null) { LOG.error("Request is null."); return null; } CheckPolicyRequestType checkPolicyRequest = transformPRPAIN201305UV02ToCheckPolicy(event.getPRPAIN201305UV02(), event.getAssertion()); LOG.debug("End -- PatientDiscoveryPolicyTransformHelper.transformPatientDiscoveryEntityToCheckPolicy()"); return checkPolicyRequest; }  CheckPolicyRequestType transformPatientDiscoveryNhincToCheckPolicy(PatDiscReqEventType event); CheckPolicyRequestType transformPRPAIN201305UV02ToCheckPolicy(PRPAIN201305UV02 prpain201305UV02,
        AssertionType assertion); CheckPolicyRequestType transformPatientDiscoveryEntityToCheckPolicy(
        RespondingGatewayPRPAIN201305UV02RequestType event);  }
@Test public void testTransformPatientDiscoveryEntityToCheckPolicyWillPass() { RespondingGatewayPRPAIN201305UV02RequestType event = new RespondingGatewayPRPAIN201305UV02RequestType(); PRPAMT201301UV02Patient patient = new PRPAMT201301UV02Patient(); II patId = new II(); patId.setExtension("1234"); patId.setRoot("1.1.1"); JAXBElement<PRPAMT201301UV02Person> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", "0101195", "123456789"); patient = HL7PatientTransforms.create201301Patient(person, patId); PRPAIN201305UV02 msg = HL7PRPA201305Transforms.createPRPA201305(patient, "1.1", "2.2", "1.1.1"); event.setPRPAIN201305UV02(msg); event.setAssertion(new AssertionType()); PatientDiscoveryPolicyTransformHelper testSubject = new PatientDiscoveryPolicyTransformHelper(); CheckPolicyRequestType result = testSubject.transformPatientDiscoveryEntityToCheckPolicy(event); assertNotNull(result); assertNotNull(result.getRequest()); assertNotNull(result.getRequest().getResource()); assertEquals(1, result.getRequest().getResource().size()); assertNotNull(result.getRequest().getSubject()); assertEquals(1, result.getRequest().getSubject().size()); verifyHomeCommunityId(result, "2.2"); verifyPatientId(result, patId); }
@Test public void testTransformPatientDiscoveryEntityToCheckPolicyNoPatId() { RespondingGatewayPRPAIN201305UV02RequestType event = new RespondingGatewayPRPAIN201305UV02RequestType(); PRPAMT201301UV02Patient patient = new PRPAMT201301UV02Patient(); II patId = null; JAXBElement<PRPAMT201301UV02Person> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", "0101195", null); patient = HL7PatientTransforms.create201301Patient(person, patId); PRPAIN201305UV02 msg = HL7PRPA201305Transforms.createPRPA201305(patient, "1.1", "2.2", "1.1.1"); event.setPRPAIN201305UV02(msg); event.setAssertion(new AssertionType()); PatientDiscoveryPolicyTransformHelper testSubject = new PatientDiscoveryPolicyTransformHelper(); CheckPolicyRequestType result = testSubject.transformPatientDiscoveryEntityToCheckPolicy(event); assertNotNull(result); verifyNoPatientId(result); }