PatientDiscovery201306Processor { public PRPAIN201306UV02 createNewRequest(PRPAIN201306UV02 request, String targetCommunityId) { PRPAIN201306UV02 newRequest = request; if (request != null && NullChecker.isNotNullish(targetCommunityId)) { newRequest.getReceiver().clear(); MCCIMT000300UV01Receiver oNewReceiver = HL7ReceiverTransforms .createMCCIMT000300UV01Receiver(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; }  PRPAIN201306UV02 createNewRequest(PRPAIN201306UV02 request, String targetCommunityId); void storeMapping(PRPAIN201306UV02 request);  }
@Test public void testCreateNewRequest() { System.out.println("testCreateNewRequest"); JAXBElement<PRPAMT201301UV02Person> queryPerson = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", null, null); PRPAMT201301UV02Patient queryPatient = HL7PatientTransforms.create201301Patient(queryPerson, "1234", "1.1.1"); PRPAIN201305UV02 query = HL7PRPA201305Transforms.createPRPA201305(queryPatient, "1.1", "2.2", "1.1.1"); JAXBElement<PRPAMT201301UV02Person> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", null, null); PRPAMT201301UV02Patient patient = HL7PatientTransforms.create201301Patient(person, null, null); PRPAIN201306UV02 msg = HL7PRPA201306Transforms.createPRPA201306(patient, "2.2", "1.1.1", "1.1", "2.2.2", query); String targetCommunityId = "3.3"; PatientDiscovery201306Processor instance = new PatientDiscovery201306Processor(); PRPAIN201306UV02 result = instance.createNewRequest(msg, targetCommunityId); assertEquals(targetCommunityId, result.getReceiver().get(0).getDevice().getAsAgent().getValue() .getRepresentedOrganization().getValue().getId().get(0).getRoot()); }