test_class.declarator: tenderPriceByTypeYearController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private TenderPriceByTypeYearController tenderPriceByTypeYearController;
test_class.type: TenderPriceByTypeYearController
test_class.var_name: tenderPriceByTypeYearController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/TenderPriceByTypeYearControllerTest.java
test_class.identifier: TenderPriceByTypeYearControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void tenderPriceByProcurementMethod() throws Exception {
          final List<Document> tenderPriceByProcurementMethod = tenderPriceByTypeYearController
                  .tenderPriceByProcurementMethod(new YearFilterPagingRequest());
  
          final Document first = tenderPriceByProcurementMethod.get(0);
          String procurementMethod = (String) first.get(TenderPriceByTypeYearController.Keys.PROCUREMENT_METHOD);
          Number totalTenderAmount = (Number) first.get(TenderPriceByTypeYearController.Keys.TOTAL_TENDER_AMOUNT);
          Assert.assertEquals("selective", procurementMethod);
          Assert.assertEquals(600000.0, totalTenderAmount.doubleValue(), 0);
  
          final Document second = tenderPriceByProcurementMethod.get(1);
          procurementMethod = (String) second.get(TenderPriceByTypeYearController.Keys.PROCUREMENT_METHOD);
          totalTenderAmount = (Number) second.get(TenderPriceByTypeYearController.Keys.TOTAL_TENDER_AMOUNT);
          Assert.assertEquals("open", procurementMethod);
          Assert.assertEquals(9000.0, totalTenderAmount.doubleValue(), 0);
      }
test_case.class_method_signature: TenderPriceByTypeYearControllerTest.tenderPriceByProcurementMethod()
test_case.full_signature: @Test public void tenderPriceByProcurementMethod()
test_case.identifier: tenderPriceByProcurementMethod
test_case.invocations: tenderPriceByProcurementMethod get get get assertEquals assertEquals doubleValue get get get assertEquals assertEquals doubleValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void tenderPriceByProcurementMethod()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/TenderPriceByTypeYearController.java
focal_class.identifier: TenderPriceByTypeYearController
focal_class.class_method_signature: TenderPriceByTypeYearController.tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Returns the tender price by OCDS type (procurementMethod), by year. " + "The OCDS type is read from tender.procurementMethod. The tender price is read from " + MongoConstants.FieldNames.TENDER_VALUE_AMOUNT) @RequestMapping(value = "/api/tenderPriceByProcurementMethod", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: tenderPriceByProcurementMethod
focal_class.modifiers: @ApiOperation(value = "Returns the tender price by OCDS type (procurementMethod), by year. " + "The OCDS type is read from tender.procurementMethod. The tender price is read from " + MongoConstants.FieldNames.TENDER_VALUE_AMOUNT) @RequestMapping(value = "/api/tenderPriceByProcurementMethod", 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> tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Returns the tender price by OCDS type (procurementMethod), by year. "
              + "The OCDS type is read from tender.procurementMethod. The tender price is read from "
              + MongoConstants.FieldNames.TENDER_VALUE_AMOUNT)
      @RequestMapping(value = "/api/tenderPriceByProcurementMethod", method = {RequestMethod.POST,
              RequestMethod.GET}, produces = "application/json")
      public List<Document> tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          DBObject project = new BasicDBObject();
          project.put("tender." + Keys.PROCUREMENT_METHOD, 1);
          project.put("tender.value", 1);
  
          Aggregation agg = newAggregation(
                  match(where("awards").elemMatch(where("status").is(Award.Status.active.toString()))
                          .and("tender.value")
                          .exists(true)
                          .andOperator(getYearDefaultFilterCriteria(
                                  filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE
                          ))),
                  new CustomProjectionOperation(project), group("tender." + Keys.PROCUREMENT_METHOD)
                          .sum(ref(MongoConstants.FieldNames.TENDER_VALUE_AMOUNT)).as(Keys.TOTAL_TENDER_AMOUNT),
                  project().and(Fields.UNDERSCORE_ID).as(Keys.PROCUREMENT_METHOD).andInclude(Keys.TOTAL_TENDER_AMOUNT)
                          .andExclude(Fields.UNDERSCORE_ID),
                  sort(Direction.DESC, Keys.TOTAL_TENDER_AMOUNT)
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: TenderPriceByTypeYearController.tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Returns the tender price by OCDS type (procurementMethod), by year. " + "The OCDS type is read from tender.procurementMethod. The tender price is read from " + MongoConstants.FieldNames.TENDER_VALUE_AMOUNT) @RequestMapping(value = "/api/tenderPriceByProcurementMethod", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: tenderPriceByProcurementMethod
focal_method.invocations: put put newAggregation match andOperator exists and elemMatch where is where toString getYearDefaultFilterCriteria as sum group ref andExclude andInclude as and project sort releaseAgg
focal_method.modifiers: @ApiOperation(value = "Returns the tender price by OCDS type (procurementMethod), by year. " + "The OCDS type is read from tender.procurementMethod. The tender price is read from " + MongoConstants.FieldNames.TENDER_VALUE_AMOUNT) @RequestMapping(value = "/api/tenderPriceByProcurementMethod", 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> tenderPriceByProcurementMethod(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)