use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TendersByItemClassificationTest method tendersByItemClassification.
@Test
public void tendersByItemClassification() throws Exception {
final List<DBObject> numberOfTendersByItem = tendersByItemClassification.tendersByItemClassification(new YearFilterPagingRequest());
final DBObject 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 DBObject 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);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TopTenControllerTest method topTenLargestAwards.
@Test
public void topTenLargestAwards() throws Exception {
final List<DBObject> topTenLargestAwards = topTenController.topTenLargestAwards(new YearFilterPagingRequest());
Assert.assertEquals(2, topTenLargestAwards.size());
final DBObject first = topTenLargestAwards.get(0);
BasicDBObject awards = (BasicDBObject) first.get("awards");
BasicDBObject value = (BasicDBObject) awards.get("value");
double amount = (double) value.get("amount");
Assert.assertEquals(6000000.0, amount, 0);
final DBObject second = topTenLargestAwards.get(1);
awards = (BasicDBObject) second.get("awards");
value = (BasicDBObject) awards.get("value");
amount = (double) value.get("amount");
Assert.assertEquals(40000.0, amount, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TopTenControllerTest method topTenLargestSuppliers.
@Test
public void topTenLargestSuppliers() throws Exception {
final List<DBObject> topTenLargestSuppliers = topTenController.topTenLargestSuppliers(new YearFilterPagingRequest());
final DBObject first = topTenLargestSuppliers.get(0);
Assert.assertEquals(6000000d, first.get(TopTenController.Keys.TOTAL_AWARD_AMOUNT));
Assert.assertEquals(1, first.get(TopTenController.Keys.TOTAL_CONTRACTS));
Assert.assertEquals("E09000005", ((Collection) first.get(TopTenController.Keys.PROCURING_ENTITY_IDS)).iterator().next());
Assert.assertEquals("GB-COH-1234567845", first.get(TopTenController.Keys.SUPPLIER_ID));
Assert.assertEquals(1, first.get(TopTenController.Keys.PROCURING_ENTITY_IDS_COUNT));
Assert.assertEquals(2, topTenLargestSuppliers.size());
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class CorruptionRiskDashboardCrosstabTest method testI077CrossTab.
@Test
public void testI077CrossTab() {
List<DBObject> flagStats = flagI077CrosstabController.flagStats(new YearFilterPagingRequest());
Assert.assertEquals(0, flagStats.size());
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class CorruptionRiskDashboardCrosstabTest method testI019CrossTab.
@Test
public void testI019CrossTab() {
List<DBObject> flagStats = flagI019CrosstabController.flagStats(new YearFilterPagingRequest());
Assert.assertEquals(1, flagStats.get(0).get(flagI019CrosstabController.getFlagDesignation(FlagsConstants.I007_VALUE)));
Assert.assertEquals(1, flagStats.get(0).get(flagI019CrosstabController.getFlagDesignation(FlagsConstants.I019_VALUE)));
}
Aggregations