PatientDiscovery201305Processor implements PatientDiscoveryProcessor { public PRPAIN201305UV02 createNewRequest(PRPAIN201305UV02 request, String targetCommunityId) { PRPAIN201305UV02 newRequest = request; if (request != null && NullChecker.isNotNullish(targetCommunityId)) { newRequest.getReceiver().clear(); MCCIMT000100UV01Receiver oNewReceiver = HL7ReceiverTransforms .createMCCIMT000100UV01Receiver(targetCommunityId); newRequest.getReceiver().add(oNewReceiver); LOG.debug("Created a new request for target communityId: {}", targetCommunityId); } else { LOG.error( "A null input paramter was passed to the method: createNewRequest in class: PatientDiscovery201305Processor"); return null; } return newRequest; }  @Override PRPAIN201306UV02 process201305(PRPAIN201305UV02 request, AssertionType assertion); void storeLocalMapping(RespondingGatewayPRPAIN201305UV02RequestType request); PRPAIN201306UV02 queryMpiForPatients(PRPAIN201305UV02 query, AssertionType assertion); PRPAIN201305UV02 createNewRequest(PRPAIN201305UV02 request, String targetCommunityId); II extractPatientIdFrom201305(PRPAIN201305UV02 request);  }
@Test public void testCreateNewRequest() { System.out.println("testCreateNewRequest"); String targetCommunityId = "3.3"; PatientDiscovery201305Processor instance = new PatientDiscovery201305Processor(); JAXBElement<PRPAMT201301UV02Person> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", null, null); PRPAMT201301UV02Patient patient = HL7PatientTransforms.create201301Patient(person, "1234", "1.1.1"); PRPAIN201305UV02 request = HL7PRPA201305Transforms.createPRPA201305(patient, "1.1", "2.2", "1.1.1"); PRPAIN201305UV02 result = instance.createNewRequest(request, targetCommunityId); TestHelper.assertReceiverEquals(targetCommunityId, result); }
@Test public void testCreateNewRequestNullInput() { System.out.println("testCreateNewRequestNullInput"); PatientDiscovery201305Processor instance = new PatientDiscovery201305Processor(); JAXBElement<PRPAMT201301UV02Person> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", null, null); PRPAMT201301UV02Patient patient = HL7PatientTransforms.create201301Patient(person, "1234", "1.1.1"); PRPAIN201305UV02 request = HL7PRPA201305Transforms.createPRPA201305(patient, "1.1", "2.2", "1.1.1"); PRPAIN201305UV02 result = instance.createNewRequest(request, null); assertNull(result); }