@Test public void testTotalingProjectIncomesForPeriod() throws Exception { Assert.assertEquals(7, document.getBudgetProjectIncomes().size()); Assert.assertEquals(4, document.getProjectIncomePeriodTotalsForEachBudgetPeriod().size()); Assert.assertEquals(_1K, extractPeriodTotal(document.getBudgetPeriod(0)), 0.01); Assert.assertEquals(_2K, extractPeriodTotal(document.getBudgetPeriod(1)), 0.01); Assert.assertEquals(_3K + _500, extractPeriodTotal(document.getBudgetPeriod(2)), 0.01); Assert.assertEquals(_4K + _500 + _1K, extractPeriodTotal(document.getBudgetPeriod(3)), 0.01); }
private double extractPeriodTotal(BudgetPeriod budgetPeriod) { return document .getProjectIncomePeriodTotalsForEachBudgetPeriod() .get(budgetPeriod.getBudgetPeriod() - 1) .doubleValue(); }