### Question:
DiscountingPaymentPricer { public double presentValueAmount(Payment payment, BaseProvider provider) { if (provider.getValuationDate().isAfter(payment.getDate())) { return 0d; } double df = provider.discountFactor(payment.getCurrency(), payment.getDate()); return payment.getAmount() * df; } DiscountingPaymentPricer(); CurrencyAmount presentValue(Payment payment, BaseProvider provider); CurrencyAmount presentValue(Payment payment, DiscountFactors discountFactors); double presentValueAmount(Payment payment, BaseProvider provider); CurrencyAmount presentValueWithSpread(
      Payment payment,
      DiscountFactors discountFactors,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear); ExplainMap explainPresentValue(Payment payment, BaseProvider provider); PointSensitivityBuilder presentValueSensitivity(Payment payment, BaseProvider provider); PointSensitivityBuilder presentValueSensitivity(Payment payment, DiscountFactors discountFactors); PointSensitivityBuilder presentValueSensitivityWithSpread(
      Payment payment,
      DiscountFactors discountFactors,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear); CurrencyAmount forecastValue(Payment payment, BaseProvider provider); double forecastValueAmount(Payment payment, BaseProvider provider); CashFlows cashFlows(Payment payment, BaseProvider provider); MultiCurrencyAmount currencyExposure(Payment payment, BaseProvider provider); CurrencyAmount currentCash(Payment payment, BaseProvider provider); static final DiscountingPaymentPricer DEFAULT; }### Answer:
@Test public void test_presentValueAmount_provider() { double computed = PRICER.presentValueAmount(PAYMENT, PROVIDER); double expected = NOTIONAL_USD * DF; assertThat(computed).isCloseTo(expected, offset(NOTIONAL_USD * TOL)); }
@Test public void test_presentValueAmount_provider_ended() { double computed = PRICER.presentValueAmount(PAYMENT_PAST, PROVIDER); assertThat(computed).isCloseTo(0d, offset(0d)); }