### Question:
DiscountingNotionalExchangePricer implements SwapPaymentEventPricer<NotionalExchange> { @Override public double currentCash(NotionalExchange event, RatesProvider provider) { return paymentPricer.currentCash(event.getPayment(), provider).getAmount(); } DiscountingNotionalExchangePricer(DiscountingPaymentPricer paymentPricer); @Override double presentValue(NotionalExchange event, RatesProvider provider); @Override PointSensitivityBuilder presentValueSensitivity(NotionalExchange event, RatesProvider provider); @Override double forecastValue(NotionalExchange event, RatesProvider provider); @Override PointSensitivityBuilder forecastValueSensitivity(NotionalExchange event, RatesProvider provider); @Override void explainPresentValue(NotionalExchange event, RatesProvider provider, ExplainMapBuilder builder); @Override MultiCurrencyAmount currencyExposure(NotionalExchange event, RatesProvider provider); @Override double currentCash(NotionalExchange event, RatesProvider provider); static final DiscountingNotionalExchangePricer DEFAULT; }### Answer:
@Test public void test_currentCash_zero() { ImmutableRatesProvider prov = ImmutableRatesProvider.builder(VAL_DATE) .discountCurve(GBP, DISCOUNT_CURVE_GBP) .build(); DiscountingNotionalExchangePricer test = DiscountingNotionalExchangePricer.DEFAULT; double computed = test.currentCash(NOTIONAL_EXCHANGE_REC_GBP, prov); assertThat(computed).isEqualTo(0d); }
@Test public void test_currentCash_onPayment() { ImmutableRatesProvider prov = ImmutableRatesProvider.builder(NOTIONAL_EXCHANGE_REC_GBP.getPaymentDate()) .discountCurve(GBP, DISCOUNT_CURVE_GBP) .build(); DiscountingNotionalExchangePricer test = DiscountingNotionalExchangePricer.DEFAULT; double notional = NOTIONAL_EXCHANGE_REC_GBP.getPaymentAmount().getAmount(); double computed = test.currentCash(NOTIONAL_EXCHANGE_REC_GBP, prov); assertThat(computed).isEqualTo(notional); }