LocationInfowindowController extends GenericOCDSController { @ApiOperation(value = "Displays the awards, filtered by location. See the location filter " + "for the options to filter by") @RequestMapping(value = "/api/awardsByLocation", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) public List<Document> awardsByLocation( @ModelAttribute @Valid final YearFilterPagingRequest filter) { Aggregation agg = newAggregation( match(where("awards.0").exists(true).orOperator( where("tender.items.deliveryLocation._id").exists(true) ) .andOperator(getYearDefaultFilterCriteria(filter, MongoConstants.FieldNames.AWARDS_DATE))), project("awards").andExclude(Fields.UNDERSCORE_ID), unwind("awards"), match(getYearDefaultFilterCriteria(filter.awardFiltering(), MongoConstants.FieldNames.AWARDS_DATE)), skip(filter.getSkip()), limit(filter.getPageSize()) ); return releaseAgg(agg); }  @ApiOperation(value = "Displays the tenders filtered by location. See the location filter " + "for the options to filter by") @RequestMapping(value = "/api/tendersByLocation", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) List<Document> tendersByLocation(
            @ModelAttribute @Valid final YearFilterPagingRequest filter); @ApiOperation(value = "Displays the planning items, filtered by location. See the location filter " + "for the options to filter by") @RequestMapping(value = "/api/planningByLocation", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) List<Document> planningByLocation(
            @ModelAttribute @Valid final DefaultFilterPagingRequest filter); @ApiOperation(value = "Displays the awards, filtered by location. See the location filter " + "for the options to filter by") @RequestMapping(value = "/api/awardsByLocation", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") @JsonView(Views.Public.class) List<Document> awardsByLocation(
            @ModelAttribute @Valid final YearFilterPagingRequest filter);  }
@Test public void awardsByLocation() throws Exception { final List<Document> awardsByLocation = locationInfowindowController.awardsByLocation( new YearFilterPagingRequest()); Assert.assertEquals(1, awardsByLocation.size()); final Document first = awardsByLocation.get(0); }