### Question:
DiscountingFxResetNotionalExchangePricer implements SwapPaymentEventPricer<FxResetNotionalExchange> { @Override public double currentCash(FxResetNotionalExchange event, RatesProvider provider) { if (provider.getValuationDate().isEqual(event.getPaymentDate())) { return forecastValue(event, provider); } return 0d; } DiscountingFxResetNotionalExchangePricer(); @Override double presentValue(FxResetNotionalExchange event, RatesProvider provider); @Override PointSensitivityBuilder presentValueSensitivity(FxResetNotionalExchange event, RatesProvider provider); @Override double forecastValue(FxResetNotionalExchange event, RatesProvider provider); @Override PointSensitivityBuilder forecastValueSensitivity(FxResetNotionalExchange event, RatesProvider provider); @Override void explainPresentValue(FxResetNotionalExchange event, RatesProvider provider, ExplainMapBuilder builder); @Override MultiCurrencyAmount currencyExposure(FxResetNotionalExchange event, RatesProvider provider); @Override double currentCash(FxResetNotionalExchange event, RatesProvider provider); static final DiscountingFxResetNotionalExchangePricer DEFAULT; }### Answer:
@Test public void test_currentCash_zero() { ImmutableRatesProvider prov = ImmutableRatesProvider.builder(VAL_DATE) .fxRateProvider(FX_MATRIX) .discountCurve(GBP, DISCOUNT_CURVE_GBP) .discountCurve(USD, DISCOUNT_CURVE_USD) .build(); DiscountingFxResetNotionalExchangePricer test = new DiscountingFxResetNotionalExchangePricer(); double cc = test.currentCash(FX_RESET_NOTIONAL_EXCHANGE_REC_USD, prov); assertThat(cc).isEqualTo(0d); }
@Test public void test_currentCash_onPayment() { double eps = 1.0e-14; ImmutableRatesProvider prov = ImmutableRatesProvider.builder(FX_RESET_NOTIONAL_EXCHANGE_REC_USD.getPaymentDate()) .fxRateProvider(FX_MATRIX) .discountCurve(GBP, DISCOUNT_CURVE_GBP) .discountCurve(USD, DISCOUNT_CURVE_USD) .build(); DiscountingFxResetNotionalExchangePricer test = new DiscountingFxResetNotionalExchangePricer(); double rate = prov.fxIndexRates(FX_RESET_NOTIONAL_EXCHANGE_REC_USD.getObservation().getIndex()).rate( FX_RESET_NOTIONAL_EXCHANGE_REC_USD.getObservation(), FX_RESET_NOTIONAL_EXCHANGE_REC_USD.getReferenceCurrency()); double ccUSD = test.currentCash(FX_RESET_NOTIONAL_EXCHANGE_REC_USD, prov); assertThat(ccUSD).isCloseTo(NOTIONAL * rate, offset(eps)); double ccGBP = test.currentCash(FX_RESET_NOTIONAL_EXCHANGE_PAY_GBP, prov); assertThat(ccGBP).isCloseTo(-NOTIONAL / rate, offset(eps)); }