@Test public void shouldGetOnlyHealthFacilities() { Facility healthFacility = new Facility(1L, "HF", "facility1", null, null, new FacilityType("HF"), false); Facility DDMFacility = new Facility(1L, "DDM", "facility2", null, null, new FacilityType("DDM"), false); Facility DPMFacility = new Facility(1L, "DPM", "facility3", null, null, new FacilityType("DPM"), false); List<Facility> facilities = asList(healthFacility, DDMFacility, DPMFacility); when(facilityMapper.getAllReportFacilities()).thenReturn(facilities); List<Facility> allHealthFacilities = facilityProductsReportDataProvider.getAllHealthFacilities(); assertThat(allHealthFacilities.size(), is(1)); assertThat(allHealthFacilities.get(0).getFacilityType().getCode(), is("HF")); }
@Transactional protected List<Facility> getAllHealthFacilities() { List<Facility> allReportFacilities = facilityMapper.getAllReportFacilities(); return from(allReportFacilities).filter(new Predicate<Facility>() { @Override public boolean apply(Facility input) { return isHealthFacility(input); } }).toList(); }
FacilityProductsReportDataProvider { @Transactional protected List<Facility> getAllHealthFacilities() { List<Facility> allReportFacilities = facilityMapper.getAllReportFacilities(); return from(allReportFacilities).filter(new Predicate<Facility>() { @Override public boolean apply(Facility input) { return isHealthFacility(input); } }).toList(); } }
FacilityProductsReportDataProvider { @Transactional protected List<Facility> getAllHealthFacilities() { List<Facility> allReportFacilities = facilityMapper.getAllReportFacilities(); return from(allReportFacilities).filter(new Predicate<Facility>() { @Override public boolean apply(Facility input) { return isHealthFacility(input); } }).toList(); }  }
FacilityProductsReportDataProvider { @Transactional protected List<Facility> getAllHealthFacilities() { List<Facility> allReportFacilities = facilityMapper.getAllReportFacilities(); return from(allReportFacilities).filter(new Predicate<Facility>() { @Override public boolean apply(Facility input) { return isHealthFacility(input); } }).toList(); }  List<FacilityProductReportEntry> getReportDataForSingleProduct(final Long geographicZoneId, final Long productId, final Date endTime); List<FacilityProductReportEntry> getReportDataForAllProducts(Long facilityId, final Date endTime); }
FacilityProductsReportDataProvider { @Transactional protected List<Facility> getAllHealthFacilities() { List<Facility> allReportFacilities = facilityMapper.getAllReportFacilities(); return from(allReportFacilities).filter(new Predicate<Facility>() { @Override public boolean apply(Facility input) { return isHealthFacility(input); } }).toList(); }  List<FacilityProductReportEntry> getReportDataForSingleProduct(final Long geographicZoneId, final Long productId, final Date endTime); List<FacilityProductReportEntry> getReportDataForAllProducts(Long facilityId, final Date endTime); static final String DISTRICT_CODE; static final String PROVINCE_CODE; }