test_class.declarator: fundingByLocationController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private FundingByLocationController fundingByLocationController;
test_class.type: FundingByLocationController
test_class.var_name: fundingByLocationController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/FundingByLocationControllerTest.java
test_class.identifier: FundingByLocationControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void fundingByTenderDeliveryLocation() throws Exception {
          final List<Document> fundingByTenderDeliveryLocation = fundingByLocationController
                  .fundingByTenderDeliveryLocation(new YearFilterPagingRequest());
  
          final Document first = fundingByTenderDeliveryLocation.get(0);
          int year = (int) first.get(FundingByLocationController.Keys.YEAR);
          BasicDBObject deliveryLocation = (BasicDBObject) first
                  .get(FundingByLocationController.Keys.ITEMS_DELIVERY_LOCATION);
          BasicDBObject geometry = (BasicDBObject) deliveryLocation.get("geometry");
          String geometryType = (String) geometry.get("type");
          List<Double> coordinates = (List<Double>) geometry.get("coordinates");
          double totalTendersAmount = (double) first.get(FundingByLocationController.Keys.TOTAL_TENDERS_AMOUNT);
          int tendersCount = (int) first.get(FundingByLocationController.Keys.TENDERS_COUNT);
  
          Assert.assertEquals(2015, year);
          Assert.assertEquals("Point", geometryType);
          Assert.assertEquals(new ArrayList<>(Arrays.asList(45.9432, 24.9668)), coordinates);
          Assert.assertEquals(9000.0, totalTendersAmount, 0);
          Assert.assertEquals(1, tendersCount);
      }
test_case.class_method_signature: FundingByLocationControllerTest.fundingByTenderDeliveryLocation()
test_case.full_signature: @Test public void fundingByTenderDeliveryLocation()
test_case.identifier: fundingByTenderDeliveryLocation
test_case.invocations: fundingByTenderDeliveryLocation get get get get get get get get assertEquals assertEquals assertEquals asList assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void fundingByTenderDeliveryLocation()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/FundingByLocationController.java
focal_class.identifier: FundingByLocationController
focal_class.class_method_signature: FundingByLocationController.fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Total estimated funding (tender.value) grouped by " + "tender.items.deliveryLocation and also grouped by year." + " The endpoint also returns the count of tenders for each location. " + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate") @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: fundingByTenderDeliveryLocation
focal_class.modifiers: @ApiOperation(value = "Total estimated funding (tender.value) grouped by " + "tender.items.deliveryLocation and also grouped by year." + " The endpoint also returns the count of tenders for each location. " + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate") @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public
focal_class.parameters: (
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.return: List<Document>
focal_class.signature: List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: FundingByLocationController.qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location," + " that is the array tender.items.deliveryLocation has to have items." + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.") @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: qualityFundingByTenderDeliveryLocation
focal_class.modifiers: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location," + " that is the array tender.items.deliveryLocation has to have items." + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.") @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public
focal_class.parameters: (
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.return: List<Document>
focal_class.signature: List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Total estimated funding (tender.value) grouped by "
              + "tender.items.deliveryLocation and also grouped by year."
              + " The endpoint also returns the count of tenders for each location. "
              + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate")
      @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST,
              RequestMethod.GET }, produces = "application/json")
      public List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          DBObject project = new BasicDBObject();
          project.put("tender.items.deliveryLocation", 1);
          project.put(MongoConstants.FieldNames.TENDER_VALUE_AMOUNT, 1);
          addYearlyMonthlyProjection(filter, project, ref(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE));
  
          Aggregation agg = newAggregation(
                  match(where("tender").exists(true).and(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE).exists(true)
                          .andOperator(getYearDefaultFilterCriteria(filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE))),
                  new CustomProjectionOperation(project), unwind("$tender.items"),
                  unwind("$tender.items.deliveryLocation"),
                  project(getYearlyMonthlyGroupingFields(filter)).and(MongoConstants.FieldNames.TENDER_VALUE_AMOUNT)
                          .as("tenderAmount")
                          .and("tender.items.deliveryLocation").as("deliveryLocation"),
                  match(where("deliveryLocation.geometry.coordinates.0").exists(true)),
                  group(getYearlyMonthlyGroupingFields(filter, Keys.ITEMS_DELIVERY_LOCATION))
                          .sum("tenderAmount").as(Keys.TOTAL_TENDERS_AMOUNT).count().as(Keys.TENDERS_COUNT),
                  getSortByYearMonth(filter)
          // ,skip(filter.getSkip()), limit(filter.getPageSize())
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: FundingByLocationController.fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Total estimated funding (tender.value) grouped by " + "tender.items.deliveryLocation and also grouped by year." + " The endpoint also returns the count of tenders for each location. " + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate") @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: fundingByTenderDeliveryLocation
focal_method.invocations: put put addYearlyMonthlyProjection ref newAggregation match andOperator exists and exists where getYearDefaultFilterCriteria unwind unwind as and as and project getYearlyMonthlyGroupingFields match exists where as count as sum group getYearlyMonthlyGroupingFields getSortByYearMonth releaseAgg
focal_method.modifiers: @ApiOperation(value = "Total estimated funding (tender.value) grouped by " + "tender.items.deliveryLocation and also grouped by year." + " The endpoint also returns the count of tenders for each location. " + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate") @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public
focal_method.parameters: (
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.return: List<Document>
focal_method.signature: List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)