PRPAIN201305UV02Parser { public static II getPatientId(PRPAIN201305UV02 request) { II livingSubjectId = null; if (request != null && request.getControlActProcess() != null && request.getControlActProcess().getQueryByParameter() != null && request.getControlActProcess().getQueryByParameter().getValue() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() .getLivingSubjectId() != null) { List<PRPAMT201306UV02LivingSubjectId> ids = request.getControlActProcess().getQueryByParameter().getValue() .getParameterList().getLivingSubjectId(); if (ids != null && !ids.isEmpty()) { if (ids.size() == 1) { livingSubjectId = getLivingSubjectId(ids.get(0)); } else if (ids.size() > 1) { livingSubjectId = getLivingSubjectIdFromAuthorOrPerformerValue(request, ids); } } } else { LOG.error("PatientId doesn't exist in the received PRPAIN201305UV02 message"); } return livingSubjectId; }  static II getPatientId(PRPAIN201305UV02 request); static String getQueryId(PRPAIN201305UV02 request);  }
@Test public void testPatientId() { II objPid = PRPAIN201305UV02Parser.getPatientId( TestPatientDiscoveryMessageHelper.createPRPAIN201305UV02Request("Gallow", "Younger", "M", "01-12-2967", "1.1", "D12345", "2.2", "abd3453dcd24wkkks545")); assertEquals("PatientId Root mismatch", "1.1", objPid.getRoot()); assertEquals("PatientId Extension mismatch", "D12345", objPid.getExtension()); }