### Question:
DiscountingFxNdfProductPricer { public CurrencyAmount currentCash(ResolvedFxNdf ndf, RatesProvider provider) { Currency ccySettle = ndf.getSettlementCurrency(); if (provider.getValuationDate().isEqual(ndf.getPaymentDate())) { Currency ccyOther = ndf.getNonDeliverableCurrency(); CurrencyAmount notionalSettle = ndf.getSettlementCurrencyNotional(); double agreedRate = ndf.getAgreedFxRate().fxRate(ccySettle, ccyOther); double rate = provider.fxIndexRates(ndf.getIndex()).rate(ndf.getObservation(), ccySettle); return notionalSettle.multipliedBy(1d - agreedRate / rate); } return CurrencyAmount.zero(ccySettle); } DiscountingFxNdfProductPricer(); CurrencyAmount presentValue(ResolvedFxNdf ndf, RatesProvider provider); PointSensitivities presentValueSensitivity(ResolvedFxNdf ndf, RatesProvider provider); MultiCurrencyAmount currencyExposure(ResolvedFxNdf ndf, RatesProvider provider); CurrencyAmount currentCash(ResolvedFxNdf ndf, RatesProvider provider); FxRate forwardFxRate(ResolvedFxNdf ndf, RatesProvider provider); static final DiscountingFxNdfProductPricer DEFAULT; }### Answer:
@Test public void test_currentCash_zero() { CurrencyAmount computed = PRICER.currentCash(NDF, PROVIDER); assertThat(computed).isEqualTo(CurrencyAmount.zero(NDF.getSettlementCurrency())); }
@Test public void test_currentCash_onPayment() { double rate = 1111.2; LocalDate paymentDate = NDF.getPaymentDate(); RatesProvider provider = RatesProviderFxDataSets.createProvider(paymentDate, NDF.getIndex(), rate); CurrencyAmount computed = PRICER.currentCash(NDF, provider); assertThat(computed).isEqualTo(CurrencyAmount.of(NDF.getSettlementCurrency(), NOMINAL_USD * (1d - FX_RATE / rate))); }