@Test public void testNullAndEmptyImmunizationList() { try { when(this.mockJMeadowsClient.getPatientImmunizations(any(JMeadowsQuery.class))).thenReturn(null); JMeadowsQuery query = new JMeadowsQueryBuilder() .user(user) .patient(patient) .build(); PatientIds patientIds = new PatientIds.Builder() .pid(pid) .icn(icn) .uid(uid) .edipi(edipi) .build(); List<VistaDataChunk> vistaDataChunkList = jMeadowsImmunizationService.fetchDodPatientImmunizations(query, patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(this.mockJMeadowsClient.getPatientImmunizations(any(JMeadowsQuery.class))).thenReturn(new ArrayList<Immunization>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); } catch (JMeadowsException_Exception e) { fail(e.getMessage()); } }
@Override public List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaImmunizationChunk = new ArrayList<VistaDataChunk>(); List<Immunization> oaImmunization = jMeadowsClient.getPatientImmunizations(query); LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: " + ((oaImmunization == null)? "NO" : ""+oaImmunization.size()) + " results retrieved from JMeadows."); if ((oaImmunization != null) && (oaImmunization.size() > 0)) { oaImmunization = (List<Immunization>) filterOnSourceProtocol(oaImmunization, SOURCE_PROTOCOL_DODADAPTER); int iNumImmunizations = calculateNumImmunizations(oaImmunization); int iCurImmunizationIdx = 1; for (Immunization oImmunization : oaImmunization) { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: Found DoD Immunization - Processing it... idx: " + iCurImmunizationIdx); VistaDataChunk oImmunizationChunk = transformImmunizationChunk(oImmunization, patientIds, iNumImmunizations, iCurImmunizationIdx); if (oImmunizationChunk != null) { oaImmunizationChunk.add(oImmunizationChunk); iCurImmunizationIdx++; } } } return oaImmunizationChunk; }
JMeadowsImmunizationService implements IJMeadowsImmunizationService { @Override public List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaImmunizationChunk = new ArrayList<VistaDataChunk>(); List<Immunization> oaImmunization = jMeadowsClient.getPatientImmunizations(query); LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: " + ((oaImmunization == null)? "NO" : ""+oaImmunization.size()) + " results retrieved from JMeadows."); if ((oaImmunization != null) && (oaImmunization.size() > 0)) { oaImmunization = (List<Immunization>) filterOnSourceProtocol(oaImmunization, SOURCE_PROTOCOL_DODADAPTER); int iNumImmunizations = calculateNumImmunizations(oaImmunization); int iCurImmunizationIdx = 1; for (Immunization oImmunization : oaImmunization) { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: Found DoD Immunization - Processing it... idx: " + iCurImmunizationIdx); VistaDataChunk oImmunizationChunk = transformImmunizationChunk(oImmunization, patientIds, iNumImmunizations, iCurImmunizationIdx); if (oImmunizationChunk != null) { oaImmunizationChunk.add(oImmunizationChunk); iCurImmunizationIdx++; } } } return oaImmunizationChunk; } }
JMeadowsImmunizationService implements IJMeadowsImmunizationService { @Override public List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaImmunizationChunk = new ArrayList<VistaDataChunk>(); List<Immunization> oaImmunization = jMeadowsClient.getPatientImmunizations(query); LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: " + ((oaImmunization == null)? "NO" : ""+oaImmunization.size()) + " results retrieved from JMeadows."); if ((oaImmunization != null) && (oaImmunization.size() > 0)) { oaImmunization = (List<Immunization>) filterOnSourceProtocol(oaImmunization, SOURCE_PROTOCOL_DODADAPTER); int iNumImmunizations = calculateNumImmunizations(oaImmunization); int iCurImmunizationIdx = 1; for (Immunization oImmunization : oaImmunization) { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: Found DoD Immunization - Processing it... idx: " + iCurImmunizationIdx); VistaDataChunk oImmunizationChunk = transformImmunizationChunk(oImmunization, patientIds, iNumImmunizations, iCurImmunizationIdx); if (oImmunizationChunk != null) { oaImmunizationChunk.add(oImmunizationChunk); iCurImmunizationIdx++; } } } return oaImmunizationChunk; } @Autowired  JMeadowsImmunizationService(JMeadowsConfiguration jMeadowsConfiguration); }
JMeadowsImmunizationService implements IJMeadowsImmunizationService { @Override public List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaImmunizationChunk = new ArrayList<VistaDataChunk>(); List<Immunization> oaImmunization = jMeadowsClient.getPatientImmunizations(query); LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: " + ((oaImmunization == null)? "NO" : ""+oaImmunization.size()) + " results retrieved from JMeadows."); if ((oaImmunization != null) && (oaImmunization.size() > 0)) { oaImmunization = (List<Immunization>) filterOnSourceProtocol(oaImmunization, SOURCE_PROTOCOL_DODADAPTER); int iNumImmunizations = calculateNumImmunizations(oaImmunization); int iCurImmunizationIdx = 1; for (Immunization oImmunization : oaImmunization) { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: Found DoD Immunization - Processing it... idx: " + iCurImmunizationIdx); VistaDataChunk oImmunizationChunk = transformImmunizationChunk(oImmunization, patientIds, iNumImmunizations, iCurImmunizationIdx); if (oImmunizationChunk != null) { oaImmunizationChunk.add(oImmunizationChunk); iCurImmunizationIdx++; } } } return oaImmunizationChunk; } @Autowired  JMeadowsImmunizationService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds); }
JMeadowsImmunizationService implements IJMeadowsImmunizationService { @Override public List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds) throws JMeadowsException_Exception { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations - Entering method..."); validateParams(query, patientIds, USER, PATIENT); List<VistaDataChunk> oaImmunizationChunk = new ArrayList<VistaDataChunk>(); List<Immunization> oaImmunization = jMeadowsClient.getPatientImmunizations(query); LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: " + ((oaImmunization == null)? "NO" : ""+oaImmunization.size()) + " results retrieved from JMeadows."); if ((oaImmunization != null) && (oaImmunization.size() > 0)) { oaImmunization = (List<Immunization>) filterOnSourceProtocol(oaImmunization, SOURCE_PROTOCOL_DODADAPTER); int iNumImmunizations = calculateNumImmunizations(oaImmunization); int iCurImmunizationIdx = 1; for (Immunization oImmunization : oaImmunization) { LOG.debug("JMeadowsImmunizationService.fetchDodPatientImmunizations: Found DoD Immunization - Processing it... idx: " + iCurImmunizationIdx); VistaDataChunk oImmunizationChunk = transformImmunizationChunk(oImmunization, patientIds, iNumImmunizations, iCurImmunizationIdx); if (oImmunizationChunk != null) { oaImmunizationChunk.add(oImmunizationChunk); iCurImmunizationIdx++; } } } return oaImmunizationChunk; } @Autowired  JMeadowsImmunizationService(JMeadowsConfiguration jMeadowsConfiguration); void setJMeadowsClient(JMeadowsData jMeadowsClient); @Override List<VistaDataChunk> fetchDodPatientImmunizations(JMeadowsQuery query, PatientIds patientIds); static final String DOMAIN_IMMUNIZATION; }