PatientDiscovery201306Processor { protected String getAssigningAuthority(PRPAIN201306UV02 request) { String assigningAuthority = null; if (request != null && request.getControlActProcess() != null && NullChecker.isNotNullish(request.getControlActProcess().getAuthorOrPerformer()) && request.getControlActProcess().getAuthorOrPerformer().get(0) != null && request.getControlActProcess().getAuthorOrPerformer().get(0).getAssignedDevice() != null && request.getControlActProcess().getAuthorOrPerformer().get(0).getAssignedDevice().getValue() != null && NullChecker.isNotNullish(request.getControlActProcess().getAuthorOrPerformer().get(0) .getAssignedDevice().getValue().getId()) && request.getControlActProcess().getAuthorOrPerformer().get(0).getAssignedDevice().getValue().getId() .get(0) != null && NullChecker.isNotNullish(request.getControlActProcess().getAuthorOrPerformer().get(0) .getAssignedDevice().getValue().getId().get(0).getRoot())) { assigningAuthority = request.getControlActProcess().getAuthorOrPerformer().get(0).getAssignedDevice() .getValue().getId().get(0).getRoot(); } return assigningAuthority; }  PRPAIN201306UV02 createNewRequest(PRPAIN201306UV02 request, String targetCommunityId); void storeMapping(PRPAIN201306UV02 request);  }
@Test public void testGetAssigningAuthorityHappy() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); COCTMT090300UV01AssignedDevice assignedDevice = new COCTMT090300UV01AssignedDevice(); authorOrPerformer.setAssignedDevice(hl7OjbFactory .createMFMIMT700701UV01AuthorOrPerformerAssignedDevice(assignedDevice)); II id = new II(); assignedDevice.getId().add(id); id.setRoot("test_aa"); String aa = storage.getAssigningAuthority(request); assertNotNull("AssigningAuthority was null", aa); assertEquals("AssigningAuthority incorrect", "test_aa", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityHappy: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityHappy: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNoMatch() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); COCTMT090300UV01AssignedDevice assignedDevice = new COCTMT090300UV01AssignedDevice(); authorOrPerformer.setAssignedDevice(hl7OjbFactory .createMFMIMT700701UV01AuthorOrPerformerAssignedDevice(assignedDevice)); II id = new II(); assignedDevice.getId().add(id); id.setRoot("test_aa"); String aa = storage.getAssigningAuthority(request); assertNotNull("AssigningAuthority was null", aa); assertFalse("HCID incorrect", "test_aa_no_match".equals(aa)); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNoMatch: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNoMatch: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNullAssigningAuthority() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); COCTMT090300UV01AssignedDevice assignedDevice = new COCTMT090300UV01AssignedDevice(); authorOrPerformer.setAssignedDevice(hl7OjbFactory .createMFMIMT700701UV01AuthorOrPerformerAssignedDevice(assignedDevice)); II id = new II(); assignedDevice.getId().add(id); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNullAssigningAuthority: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNullAssigningAuthority: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNullId() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); COCTMT090300UV01AssignedDevice assignedDevice = new COCTMT090300UV01AssignedDevice(); authorOrPerformer.setAssignedDevice(hl7OjbFactory .createMFMIMT700701UV01AuthorOrPerformerAssignedDevice(assignedDevice)); II id = null; assignedDevice.getId().add(id); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNullId: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNullId: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityMissingId() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); COCTMT090300UV01AssignedDevice assignedDevice = new COCTMT090300UV01AssignedDevice(); authorOrPerformer.setAssignedDevice(hl7OjbFactory .createMFMIMT700701UV01AuthorOrPerformerAssignedDevice(assignedDevice)); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityMissingId: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityMissingId: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNullAssignedDevice() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); COCTMT090300UV01AssignedDevice assignedDevice = null; authorOrPerformer.setAssignedDevice(hl7OjbFactory .createMFMIMT700701UV01AuthorOrPerformerAssignedDevice(assignedDevice)); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNullAssignedDevice: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNullAssignedDevice: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityMissingAssignedDevice() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = new MFMIMT700711UV01AuthorOrPerformer(); controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityMissingAssignedDevice: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityMissingAssignedDevice: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNullAuthorOrPerformer() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); MFMIMT700711UV01AuthorOrPerformer authorOrPerformer = null; controlActProcess.getAuthorOrPerformer().add(authorOrPerformer); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNullAuthorOrPerformer: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNullAuthorOrPerformer: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityMissingAuthorOrPerformer() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlActProcess = new PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(); request.setControlActProcess(controlActProcess); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityMissingAuthorOrPerformer: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityMissingAuthorOrPerformer: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNullControlActProcess() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNullControlActProcess: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNullControlActProcess: " + t.getMessage()); } }
@Test public void testGetAssigningAuthorityNullRequest() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = null; String aa = storage.getAssigningAuthority(request); assertNull("AssigningAuthority was not null", aa); } catch (Throwable t) { System.out.println("Error running testGetAssigningAuthorityNullRequest: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetAssigningAuthorityNullRequest: " + t.getMessage()); } }