### Question:
DiscountingRatePaymentPeriodPricer implements SwapPaymentPeriodPricer<RatePaymentPeriod> { @Override public double currentCash(RatePaymentPeriod period, RatesProvider provider) { if (provider.getValuationDate().isEqual(period.getPaymentDate())) { return forecastValue(period, provider); } return 0d; } DiscountingRatePaymentPeriodPricer(
      RateComputationFn<RateComputation> rateComputationFn); @Override double presentValue(RatePaymentPeriod period, RatesProvider provider); @Override double forecastValue(RatePaymentPeriod period, RatesProvider provider); @Override double pvbp(RatePaymentPeriod paymentPeriod, RatesProvider provider); @Override double accruedInterest(RatePaymentPeriod period, RatesProvider provider); @Override PointSensitivityBuilder presentValueSensitivity(RatePaymentPeriod period, RatesProvider provider); @Override PointSensitivityBuilder forecastValueSensitivity(RatePaymentPeriod period, RatesProvider provider); @Override PointSensitivityBuilder pvbpSensitivity(RatePaymentPeriod paymentPeriod, RatesProvider provider); @Override void explainPresentValue(RatePaymentPeriod paymentPeriod, RatesProvider provider, ExplainMapBuilder builder); @Override MultiCurrencyAmount currencyExposure(RatePaymentPeriod period, RatesProvider provider); @Override double currentCash(RatePaymentPeriod period, RatesProvider provider); static final DiscountingRatePaymentPeriodPricer DEFAULT; }### Answer:
@Test public void test_currentCash_zero() { DiscountingRatePaymentPeriodPricer pricer = DiscountingRatePaymentPeriodPricer.DEFAULT; ImmutableRatesProvider provider = MULTI_GBP_USD; double computed = pricer.currentCash(PAYMENT_PERIOD_COMPOUNDING_FLAT, provider); assertThat(computed).isEqualTo(0d); }
@Test public void test_currentCash_onPayment() { DiscountingRatePaymentPeriodPricer pricer = DiscountingRatePaymentPeriodPricer.DEFAULT; RatesProvider provider = createProvider(PAYMENT_PERIOD_1.getPaymentDate()); double computed = pricer.currentCash(PAYMENT_PERIOD_1, provider); assertThat(computed).isEqualTo(RATE_1 * ACCRUAL_FACTOR_1 * NOTIONAL_100); }