### Question:
PeriodChargeCalculator { static Map<Period, BigDecimal> getPeriodAccrualInterestRate( final BigDecimal interest, final List<ScheduledCharge> scheduledCharges, final int precision) { return scheduledCharges.stream() .filter(PeriodChargeCalculator::accruedInterestCharge) .collect(Collectors.groupingBy(scheduledCharge -> scheduledCharge.getScheduledAction().getRepaymentPeriod(), Collectors.mapping(x -> chargeAmountPerPeriod(x, interest, precision), Collectors.reducing(BigDecimal.ZERO, BigDecimal::add)))); }    }### Answer:
@Test public void getPeriodAccrualRatesTest() { final Map<Period, BigDecimal> periodRates = PeriodChargeCalculator.getPeriodAccrualInterestRate(testCase.interest, testCase.scheduledCharges, testCase.precision); Assert.assertEquals(testCase.expectedPeriodRates, periodRates); }