### Question:
DiscountingKnownAmountPaymentPeriodPricer implements SwapPaymentPeriodPricer<KnownAmountSwapPaymentPeriod> { @Override public double forecastValue(KnownAmountSwapPaymentPeriod period, RatesProvider provider) { return paymentPricer.forecastValueAmount(period.getPayment(), provider); } DiscountingKnownAmountPaymentPeriodPricer(DiscountingPaymentPricer paymentPricer); @Override double presentValue(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override double forecastValue(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override double accruedInterest(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override double pvbp(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override PointSensitivityBuilder presentValueSensitivity(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override PointSensitivityBuilder forecastValueSensitivity(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override PointSensitivityBuilder pvbpSensitivity(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override void explainPresentValue(KnownAmountSwapPaymentPeriod period, RatesProvider provider, ExplainMapBuilder builder); @Override MultiCurrencyAmount currencyExposure(KnownAmountSwapPaymentPeriod period, RatesProvider provider); @Override double currentCash(KnownAmountSwapPaymentPeriod period, RatesProvider provider); static final DiscountingKnownAmountPaymentPeriodPricer DEFAULT; }### Answer:
@Test public void test_forecastValue() { SimpleRatesProvider prov = createProvider(VAL_DATE); double fvExpected = AMOUNT_1000; double fvComputed = PRICER.forecastValue(PERIOD, prov); assertThat(fvComputed).isCloseTo(fvExpected, offset(TOLERANCE_PV)); }
@Test public void test_forecastValue_inPast() { SimpleRatesProvider prov = createProvider(VAL_DATE); double fvComputed = PRICER.forecastValue(PERIOD_PAST, prov); assertThat(fvComputed).isCloseTo(0, offset(TOLERANCE_PV)); }