### Question:
ReportsService { protected ArrayList<ConsumptionValue> getConsumptionValuesForCommodityBetweenDates(final Commodity commodity, final Date startingDate, final Date endDate) { ArrayList<ConsumptionValue> consumptionValues = new ArrayList<>(); List<DispensingItem> dispensingItems = GenericService.getItems(commodity, startingDate, endDate, Dispensing.class, DispensingItem.class, context); Date stopDate = DateUtil.addDayOfMonth(endDate, 1); Date currentDate = startingDate; while (currentDate.before(stopDate)) { int total = GenericService.getTotal(currentDate, dispensingItems); ConsumptionValue consumptionValue = new ConsumptionValue(currentDate, total); consumptionValues.add(consumptionValue); currentDate = DateUtil.addDayOfMonth(currentDate, 1); } return consumptionValues; }  List<FacilityStockReportItem> getFacilityReportItemsForCategory(
            Category category, String startingYear, String startingMonth, String endingYear, String endingMonth); List<FacilityCommodityConsumptionRH1ReportItem> getFacilityCommodityConsumptionReportRH1(Category category, String startingYear,
                                                                                                    String startingMonth, String endingYear, String endingMonth); List<DateTime> getDays(Date start, Date stop); List<Integer> getDayNumbers(Date startDate, Date endDate); List<FacilityConsumptionReportRH2Item> getFacilityConsumptionReportRH2Items(Category category, String startingYear, String startingMonth, String endingYear, String endingMonth); Date convertToDate(String year, String month, boolean isStartingDate); List<MonthlyVaccineUtilizationReportItem> getMonthlyVaccineUtilizationReportItems(
            Category category, String year, String month, boolean isForDevices); BinCard generateBinCard(Commodity commodity);  }### Answer:
@Test public void shouldCalculateConsumptionWithAllDispensingItemsInDateRange() throws Exception { Category category = categories.get(0); Commodity commodity = category.getCommodities().get(0); Calendar calendar = Calendar.getInstance(); calendar.set(2014, Calendar.APRIL, 01); Date startDate = calendar.getTime(); calendar.set(2014, Calendar.APRIL, 02); createDispensingItemWithDate(commodity, calendar.getTime(), 10); calendar.set(2014, Calendar.APRIL, 03); createDispensingItemWithDate(commodity, calendar.getTime(), 10); calendar.set(2014, Calendar.APRIL, 04); createDispensingItemWithDate(commodity, calendar.getTime(), 10); createDispensingItemWithDate(commodity, calendar.getTime(), 20); calendar.set(2014, Calendar.APRIL, 06); Date endDate = calendar.getTime(); ArrayList<ConsumptionValue> values = reportsService.getConsumptionValuesForCommodityBetweenDates(commodity, startDate, endDate); assertThat(values.size(), is(daysBetween(startDate, endDate))); assertThat(values.get(0).getConsumption(), is(0)); assertThat(values.get(1).getConsumption(), is(10)); assertThat(values.get(2).getConsumption(), is(10)); assertThat(values.get(3).getConsumption(), is(30)); assertThat(values.get(4).getConsumption(), is(0)); }