test_class.declarator: tendersByItemClassification
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private TendersByItemClassification tendersByItemClassification;
test_class.type: TendersByItemClassification
test_class.var_name: tendersByItemClassification
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/TendersByItemClassificationTest.java
test_class.identifier: TendersByItemClassificationTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void tendersByItemClassification() throws Exception {
          final List<Document> numberOfTendersByItem = tendersByItemClassification
                  .tendersByItemClassification(new YearFilterPagingRequest());
  
          final Document first = numberOfTendersByItem.get(0);
          String id = (String) first.get(Fields.UNDERSCORE_ID);
          String description = (String) first.get(TendersByItemClassification.Keys.DESCRIPTION);
          int totalTenders = (int) first.get(TendersByItemClassification.Keys.TOTAL_TENDERS);
          double totalTenderAmount = (double) first.get(TendersByItemClassification.Keys.TOTAL_TENDER_AMOUNT);
          Assert.assertEquals("09100000", id);
          Assert.assertEquals("Fuels", description);
          Assert.assertEquals(1, totalTenders);
          Assert.assertEquals(9000.0, totalTenderAmount,0);
  
          final Document second = numberOfTendersByItem.get(1);
          id = (String) second.get(Fields.UNDERSCORE_ID);
          description = (String) second.get(TendersByItemClassification.Keys.DESCRIPTION);
          totalTenders = (int) second.get(TendersByItemClassification.Keys.TOTAL_TENDERS);
          totalTenderAmount = (double) second.get(TendersByItemClassification.Keys.TOTAL_TENDER_AMOUNT);
          Assert.assertEquals("45233130", id);
          Assert.assertEquals("Construction work for highways", description);
          Assert.assertEquals(2, totalTenders);
          Assert.assertEquals(1000000, totalTenderAmount, 0);
      }
test_case.class_method_signature: TendersByItemClassificationTest.tendersByItemClassification()
test_case.full_signature: @Test public void tendersByItemClassification()
test_case.identifier: tendersByItemClassification
test_case.invocations: tendersByItemClassification get get get get get assertEquals assertEquals assertEquals assertEquals get get get get get assertEquals assertEquals assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void tendersByItemClassification()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/TendersByItemClassification.java
focal_class.identifier: TendersByItemClassification
focal_class.class_method_signature: TendersByItemClassification.tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "This should show the number of tenders per tender.items.classification." + "The tender date is taken from tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/tendersByItemClassification", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: tendersByItemClassification
focal_class.modifiers: @ApiOperation(value = "This should show the number of tenders per tender.items.classification." + "The tender date is taken from tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/tendersByItemClassification", 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> tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "This should show the number of tenders per tender.items.classification."
              + "The tender date is taken from tender.tenderPeriod.startDate.")
      @RequestMapping(value = "/api/tendersByItemClassification", method = { RequestMethod.POST,
              RequestMethod.GET }, produces = "application/json")
      public List<Document> tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          DBObject project = new BasicDBObject();
          project.put(Fields.UNDERSCORE_ID, 0);
          project.put("tender." + Keys.ITEMS_CLASSIFICATION, 1);
          project.put(MongoConstants.FieldNames.TENDER_VALUE_AMOUNT, 1);
  
          Aggregation agg = newAggregation(
                  match(where(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE).exists(true)
                          .andOperator(getYearDefaultFilterCriteria(filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE))),
                  new CustomProjectionOperation(project), unwind("tender.items"),
                  group("$tender." + Keys.ITEMS_CLASSIFICATION).count().as(Keys.TOTAL_TENDERS)
                          .sum(MongoConstants.FieldNames.TENDER_VALUE_AMOUNT).as(Keys.TOTAL_TENDER_AMOUNT),
                  sort(Direction.ASC, Fields.UNDERSCORE_ID));
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: TendersByItemClassification.tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "This should show the number of tenders per tender.items.classification." + "The tender date is taken from tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/tendersByItemClassification", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: tendersByItemClassification
focal_method.invocations: put put put newAggregation match andOperator exists where getYearDefaultFilterCriteria unwind as sum as count group sort releaseAgg
focal_method.modifiers: @ApiOperation(value = "This should show the number of tenders per tender.items.classification." + "The tender date is taken from tender.tenderPeriod.startDate.") @RequestMapping(value = "/api/tendersByItemClassification", 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> tendersByItemClassification(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)