### Question:
DiscountingKnownAmountPaymentPeriodPricer implements SwapPaymentPeriodPricer<KnownAmountSwapPaymentPeriod> { @Override public double presentValue(KnownAmountSwapPaymentPeriod period, RatesProvider provider) { return paymentPricer.presentValueAmount(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_presentValue() { SimpleRatesProvider prov = createProvider(VAL_DATE); double pvExpected = AMOUNT_1000 * DISCOUNT_FACTOR; double pvComputed = PRICER.presentValue(PERIOD, prov); assertThat(pvComputed).isCloseTo(pvExpected, offset(TOLERANCE_PV)); }
@Test public void test_presentValue_inPast() { SimpleRatesProvider prov = createProvider(VAL_DATE); double pvComputed = PRICER.presentValue(PERIOD_PAST, prov); assertThat(pvComputed).isCloseTo(0, offset(TOLERANCE_PV)); }