@Test
public void percentTendersCancelled() throws Exception {

    final List<Document> percentTendersCancelled = tenderPercentagesController
            .percentTendersCancelled(new YearFilterPagingRequest());
    final Document first = percentTendersCancelled.get(0);
    int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
    int totalTenders = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
    int totalCancelled = (int) first.get(TenderPercentagesController.Keys.TOTAL_CANCELLED);
    double percentCancelled = (double) first.get(TenderPercentagesController.Keys.PERCENT_CANCELLED);
    Assert.assertEquals(2014, year);
    Assert.assertEquals(1, totalTenders);
    Assert.assertEquals(0, totalCancelled);
    Assert.assertEquals(0.0, percentCancelled, 0);
    final Document second = percentTendersCancelled.get(1);
    year = (int) second.get(TenderPercentagesController.Keys.YEAR);
    totalTenders = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
    totalCancelled = (int) second.get(TenderPercentagesController.Keys.TOTAL_CANCELLED);
    percentCancelled = (double) second.get(TenderPercentagesController.Keys.PERCENT_CANCELLED);
    Assert.assertEquals(2015, year);
    Assert.assertEquals(2, totalTenders);
    Assert.assertEquals(0, totalCancelled);
    Assert.assertEquals(0.0, percentCancelled, 0);
}