CorruptionRiskDashboardTablesController extends GenericOCDSController { @ApiOperation(value = "Returns data to show in the table on corruption risk overview page." + "This is presented as releases only with the information in the table present and unwinded by " + "flags.flaggedStats") @RequestMapping(value = "/api/corruptionRiskOverviewTable", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> corruptionRiskOverviewTable( @ModelAttribute @Valid final YearFilterPagingRequest filter) { Aggregation agg = newAggregation( match(where("flags.flaggedStats.0").exists(true) .andOperator(getYearDefaultFilterCriteria(filter, MongoConstants.FieldNames.TENDER_PERIOD_START_DATE))), unwind("flags.flaggedStats"), project("ocid", "tender.procuringEntity.name", "tender.tenderPeriod", "flags", "tender.title", "tag") .and("tender.value").as("tender.value").and("awards.value").as("awards.value") .and(MongoConstants.FieldNames.AWARDS_STATUS).as(MongoConstants.FieldNames.AWARDS_STATUS) .andExclude(Fields.UNDERSCORE_ID), sort(Sort.Direction.DESC, "flags.flaggedStats.count"), skip(filter.getSkip()), limit(filter.getPageSize()) ); return releaseAgg(agg); }  @ApiOperation(value = "Returns data to show in the table on corruption risk overview page." + "This is presented as releases only with the information in the table present and unwinded by " + "flags.flaggedStats") @RequestMapping(value = "/api/corruptionRiskOverviewTable", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") List<Document> corruptionRiskOverviewTable(
            @ModelAttribute @Valid final YearFilterPagingRequest filter); @ApiOperation(value = "Counts data to show in the table on corruption risk overview page.") @RequestMapping(value = "/api/corruptionRiskOverviewTable/count", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") List<Document> corruptionRiskOverviewTableCount(
            @ModelAttribute @Valid final YearFilterPagingRequest filter);  }
@Test public void corruptionRiskOverviewTableTest() throws Exception { final List<Document> result = corruptionRiskDashboardTablesController .corruptionRiskOverviewTable(new YearFilterPagingRequest()); Assert.assertEquals(1, result.size()); Assert.assertEquals("[ocds-endpoint-001] procuringEntity name", ((DBObject)result.get(0).get("procuringEntity")).get("name")); }