@Test
public void percentTendersAwarded() throws Exception {

    final List<Document> percentTendersAwarded = tenderPercentagesController
            .percentTendersAwarded(new YearFilterPagingRequest());
    final Document first = percentTendersAwarded.get(0);
    int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
    int totalTendersWithOneOrMoreTenderers = (int) first
            .get(TenderPercentagesController.Keys.TOTAL_TENDERS_WITH_ONE_OR_MORE_TENDERERS);
    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, totalTendersWithOneOrMoreTenderers);
    Assert.assertEquals(1, totalTendersWithTwoOrMoreTenderers);
    Assert.assertEquals(100.0, percentTenders, 0);
    final Document second = percentTendersAwarded.get(1);
    year = (int) second.get(TenderPercentagesController.Keys.YEAR);
    totalTendersWithOneOrMoreTenderers = (int) second
            .get(TenderPercentagesController.Keys.TOTAL_TENDERS_WITH_ONE_OR_MORE_TENDERERS);
    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, totalTendersWithOneOrMoreTenderers);
    Assert.assertEquals(1, totalTendersWithTwoOrMoreTenderers);
    Assert.assertEquals(50.0, percentTenders, 0);
}