EncounterWrapper extends AbstractObjectWrapper<Encounter> { public List<Obs> allObs(Concept concept) { List<Obs> obsList = new ArrayList<Obs>(); for (Obs obs : target.getAllObs()) { if (obs.getConcept().equals(concept)) { obsList.add(obs); } } return obsList; } EncounterWrapper(Encounter target); Obs firstObs(Concept concept); List<Obs> allObs(Concept concept); Provider getProvider(); void setProvider(Provider provider);  }
@Test public void allObs_shouldFindAllObsWithConcept() { Encounter e = new Encounter(); EncounterWrapper wrapper = new EncounterWrapper(e); Assert.assertEquals(new ArrayList<Obs>(), wrapper.allObs(Dictionary.getConcept(Dictionary.ANTIRETROVIRAL_USED_IN_PREGNANCY))); Obs obs0 = new Obs(); obs0.setConcept(Dictionary.getConcept(Dictionary.ANTIRETROVIRAL_USED_IN_PREGNANCY)); obs0.setValueCoded(Dictionary.getConcept(Dictionary.NEVIRAPINE)); e.addObs(obs0); Obs obs1 = new Obs(); obs1.setConcept(Dictionary.getConcept(Dictionary.ANTIRETROVIRAL_USED_IN_PREGNANCY)); obs1.setValueCoded(Dictionary.getConcept(Dictionary.ZIDOVUDINE)); e.addObs(obs1); Assert.assertEquals(2, wrapper.allObs(Dictionary.getConcept(Dictionary.ANTIRETROVIRAL_USED_IN_PREGNANCY)).size()); }