### Question:
DiscountingKnownAmountPaymentPeriodPricer implements SwapPaymentPeriodPricer<KnownAmountSwapPaymentPeriod> { @Override public double currentCash(KnownAmountSwapPaymentPeriod period, RatesProvider provider) { if (provider.getValuationDate().isEqual(period.getPaymentDate())) { return forecastValue(period, provider); } return 0d; } 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_currentCash_zero() { ImmutableRatesProvider prov = ImmutableRatesProvider.builder(VAL_DATE) .discountCurve(GBP, DISCOUNT_CURVE_GBP) .build(); double computed = PRICER.currentCash(PERIOD, prov); assertThat(computed).isEqualTo(0d); }
@Test public void test_currentCash_onPayment() { ImmutableRatesProvider prov = ImmutableRatesProvider.builder(PERIOD.getPaymentDate()) .discountCurve(GBP, DISCOUNT_CURVE_GBP) .build(); double computed = PRICER.currentCash(PERIOD, prov); assertThat(computed).isEqualTo(AMOUNT_1000); }