@Test public void getActiveVisit_shouldReturnNullForAuthenticationException() { Patient patient = TestUtils.getPatient(6); Context.getUserContext().logout(); Assert.assertThat(configurator.getActiveVisit(patient), nullValue()); }
protected Visit getActiveVisit(Patient patient) { try { List<Visit> activeVisits = Context.getVisitService().getActiveVisitsByPatient(patient); return activeVisits.size() > 0 ? activeVisits.get(0) : null; } catch (APIAuthenticationException ex) { return null; } }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { protected Visit getActiveVisit(Patient patient) { try { List<Visit> activeVisits = Context.getVisitService().getActiveVisitsByPatient(patient); return activeVisits.size() > 0 ? activeVisits.get(0) : null; } catch (APIAuthenticationException ex) { return null; } } }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { protected Visit getActiveVisit(Patient patient) { try { List<Visit> activeVisits = Context.getVisitService().getActiveVisitsByPatient(patient); return activeVisits.size() > 0 ? activeVisits.get(0) : null; } catch (APIAuthenticationException ex) { return null; } }  }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { protected Visit getActiveVisit(Patient patient) { try { List<Visit> activeVisits = Context.getVisitService().getActiveVisitsByPatient(patient); return activeVisits.size() > 0 ? activeVisits.get(0) : null; } catch (APIAuthenticationException ex) { return null; } }  @Override void configureModel(PageContext pageContext); @Override void configureModel(FragmentContext fragmentContext); }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { protected Visit getActiveVisit(Patient patient) { try { List<Visit> activeVisits = Context.getVisitService().getActiveVisitsByPatient(patient); return activeVisits.size() > 0 ? activeVisits.get(0) : null; } catch (APIAuthenticationException ex) { return null; } }  @Override void configureModel(PageContext pageContext); @Override void configureModel(FragmentContext fragmentContext);  }