PatientDiscovery201306Processor { protected String getHcid(PRPAIN201306UV02 request) { String hcid = null; if (request != null && request.getSender() != null && request.getSender().getDevice() != null && request.getSender().getDevice().getAsAgent() != null && request.getSender().getDevice().getAsAgent().getValue() != null && request.getSender().getDevice().getAsAgent().getValue().getRepresentedOrganization() != null && request.getSender().getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue() != null && NullChecker.isNotNullish(request.getSender().getDevice().getAsAgent().getValue() .getRepresentedOrganization().getValue().getId()) && request.getSender().getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue() .getId().get(0) != null && NullChecker.isNotNullish(request.getSender().getDevice().getAsAgent().getValue() .getRepresentedOrganization().getValue().getId().get(0).getRoot())) { hcid = request.getSender().getDevice().getAsAgent().getValue().getRepresentedOrganization().getValue() .getId().get(0).getRoot(); } return hcid; }  PRPAIN201306UV02 createNewRequest(PRPAIN201306UV02 request, String targetCommunityId); void storeMapping(PRPAIN201306UV02 request);  }
@Test public void testGetHcidHappy() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); MCCIMT000300UV01Organization representedOrganization = new MCCIMT000300UV01Organization(); asAgent.setRepresentedOrganization(hl7OjbFactory .createMCCIMT000300UV01AgentRepresentedOrganization(representedOrganization)); II id = new II(); representedOrganization.getId().add(id); id.setRoot("test_hcid"); String hcid = storage.getHcid(request); assertNotNull("HCID was null", hcid); assertEquals("HCID incorrect", "test_hcid", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidHappy: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidHappy: " + t.getMessage()); } }
@Test public void testGetHcidNoMatch() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); MCCIMT000300UV01Organization representedOrganization = new MCCIMT000300UV01Organization(); asAgent.setRepresentedOrganization(hl7OjbFactory .createMCCIMT000300UV01AgentRepresentedOrganization(representedOrganization)); II id = new II(); representedOrganization.getId().add(id); id.setRoot("test_hcid"); String hcid = storage.getHcid(request); assertNotNull("HCID was null", hcid); assertFalse("HCID incorrect", "test_hcid_no_match".equals(hcid)); } catch (Throwable t) { System.out.println("Error running testGetHcidNoMatch: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNoMatch: " + t.getMessage()); } }
@Test public void testGetHcidNullHcid() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); MCCIMT000300UV01Organization representedOrganization = new MCCIMT000300UV01Organization(); asAgent.setRepresentedOrganization(hl7OjbFactory .createMCCIMT000300UV01AgentRepresentedOrganization(representedOrganization)); II id = new II(); representedOrganization.getId().add(id); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullHcid: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullHcid: " + t.getMessage()); } }
@Test public void testGetHcidNullId() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); MCCIMT000300UV01Organization representedOrganization = new MCCIMT000300UV01Organization(); asAgent.setRepresentedOrganization(hl7OjbFactory .createMCCIMT000300UV01AgentRepresentedOrganization(representedOrganization)); II id = null; representedOrganization.getId().add(id); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullId: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullId: " + t.getMessage()); } }
@Test public void testGetHcidMissingId() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); MCCIMT000300UV01Organization representedOrganization = new MCCIMT000300UV01Organization(); asAgent.setRepresentedOrganization(hl7OjbFactory .createMCCIMT000300UV01AgentRepresentedOrganization(representedOrganization)); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidMissingId: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidMissingId: " + t.getMessage()); } }
@Test public void testGetHcidNullRepresentedOrganization() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); MCCIMT000300UV01Organization representedOrganization = null; asAgent.setRepresentedOrganization(hl7OjbFactory .createMCCIMT000300UV01AgentRepresentedOrganization(representedOrganization)); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullRepresentedOrganization: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullRepresentedOrganization: " + t.getMessage()); } }
@Test public void testGetHcidMissingRepresentedOrganization() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = new MCCIMT000300UV01Agent(); device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidMissingRepresentedOrganization: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidMissingRepresentedOrganization: " + t.getMessage()); } }
@Test public void testGetHcidNullAsAgent() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); org.hl7.v3.ObjectFactory hl7OjbFactory = new org.hl7.v3.ObjectFactory(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); MCCIMT000300UV01Agent asAgent = null; device.setAsAgent(hl7OjbFactory.createMCCIMT000300UV01DeviceAsAgent(asAgent)); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullAsAgent: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullAsAgent: " + t.getMessage()); } }
@Test public void testGetHcidMissingAsAgent() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); MCCIMT000300UV01Device device = new MCCIMT000300UV01Device(); sender.setDevice(device); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidMissingAsAgent: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidMissingAsAgent: " + t.getMessage()); } }
@Test public void testGetHcidNullDevice() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); MCCIMT000300UV01Sender sender = new MCCIMT000300UV01Sender(); request.setSender(sender); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullDevice: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullDevice: " + t.getMessage()); } }
@Test public void testGetHcidNullSender() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = new PRPAIN201306UV02(); String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullSender: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullSender: " + t.getMessage()); } }
@Test public void testGetHcidNullRequest() { try { PatientDiscovery201306Processor storage = new PatientDiscovery201306Processor(); PRPAIN201306UV02 request = null; String hcid = storage.getHcid(request); assertNull("HCID was not null", hcid); } catch (Throwable t) { System.out.println("Error running testGetHcidNullRequest: " + t.getMessage()); t.printStackTrace(); fail("Error running testGetHcidNullRequest: " + t.getMessage()); } }