PRPAIN201301UVParser { public static PRPAIN201301UV02MFMIMT700701UV01Subject1 parseSubjectFromMessage( org.hl7.v3.PRPAIN201301UV02 message) { if (message == null) { LOG.info("message is null - no patient"); return null; } PRPAIN201301UV02MFMIMT700701UV01ControlActProcess controlActProcess = message.getControlActProcess(); if (controlActProcess == null) { LOG.info("controlActProcess is null - no patient"); return null; } List<PRPAIN201301UV02MFMIMT700701UV01Subject1> subjects = controlActProcess.getSubject(); if (subjects == null || subjects.isEmpty()) { LOG.info("subjects is blank/null - no patient"); return null; } return subjects.get(0); }  static PRPAMT201301UV02Patient parseHL7PatientPersonFrom201301Message(org.hl7.v3.PRPAIN201301UV02 message); static PRPAMT201301UV02Patient parseHL7PatientFromMessage(org.hl7.v3.PRPAIN201301UV02 message); static PRPAIN201301UV02MFMIMT700701UV01Subject1 parseSubjectFromMessage(
        org.hl7.v3.PRPAIN201301UV02 message);  }
@Test public void ParseSubjectFromMessageWhenMessageNull() { PRPAIN201301UVParser parser = new PRPAIN201301UVParser(); PRPAIN201301UV02 message = null; PRPAIN201301UV02MFMIMT700701UV01Subject1 subject1 = parser.parseSubjectFromMessage(message); assertNull(subject1); }
@Test public void ParseSubjectFromMessageWhenControlActProcessNull() { PRPAIN201301UVParser parser = new PRPAIN201301UVParser(); PRPAIN201301UV02 message = new PRPAIN201301UV02(); PRPAIN201301UV02MFMIMT700701UV01Subject1 subject1 = parser.parseSubjectFromMessage(message); assertNull(subject1); }
@Test public void ParseSubjectFromMessageWhenSubjectNull() { PRPAIN201301UVParser parser = new PRPAIN201301UVParser(); PRPAIN201301UV02 message = new PRPAIN201301UV02(); PRPAIN201301UV02MFMIMT700701UV01ControlActProcess controlActProcess = new PRPAIN201301UV02MFMIMT700701UV01ControlActProcess(); controlActProcess.setTypeId(createTypeId()); message.setControlActProcess(controlActProcess); PRPAIN201301UV02MFMIMT700701UV01Subject1 subject1 = parser.parseSubjectFromMessage(message); assertNull(subject1); }
@Test public void testParseSubjectFromMessage() { PRPAIN201301UVParser parser = new PRPAIN201301UVParser(); PRPAIN201301UV02MFMIMT700701UV01Subject1 returnedSubject = parser.parseSubjectFromMessage(createPRPAIN201301UV02()); assertEquals(returnedSubject.getRegistrationEvent().getCustodian().getAssignedEntity().getAssignedDevice() .getValue().getDeterminerCode(), "INSTANCE"); }