use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class TenderPercentagesControllerTest method percentTendersWithTwoOrMoreTenderers.
@Test
public void percentTendersWithTwoOrMoreTenderers() throws Exception {
final List<DBObject> percentTendersWithTwoOrMoreTenderers = tenderPercentagesController.percentTendersWithTwoOrMoreTenderers(new YearFilterPagingRequest());
final DBObject first = percentTendersWithTwoOrMoreTenderers.get(0);
int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
int totalTenders = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
int totalTendersWithTwoOrMoreTenderers = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS_WITH_TWO_OR_MORE_TENDERERS);
double percentTenders = (double) first.get(TenderPercentagesController.Keys.PERCENT_TENDERS);
Assert.assertEquals(2014, year);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(1, totalTendersWithTwoOrMoreTenderers);
Assert.assertEquals(100.0, percentTenders, 0);
final DBObject second = percentTendersWithTwoOrMoreTenderers.get(1);
year = (int) second.get(TenderPercentagesController.Keys.YEAR);
totalTenders = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
totalTendersWithTwoOrMoreTenderers = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS_WITH_TWO_OR_MORE_TENDERERS);
percentTenders = (double) second.get(TenderPercentagesController.Keys.PERCENT_TENDERS);
Assert.assertEquals(2015, year);
Assert.assertEquals(2, totalTenders);
Assert.assertEquals(1, totalTendersWithTwoOrMoreTenderers);
Assert.assertEquals(50.0, percentTenders, 0);
}
Aggregations