### Question:
SabrExtrapolationReplicationCmsLegPricer { public CurrencyAmount currentCash( ResolvedCmsLeg cmsLeg, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities) { validate(ratesProvider, swaptionVolatilities); return cmsLeg.getCmsPeriods().stream() .filter(x -> x.getPaymentDate().equals(ratesProvider.getValuationDate())) .map(x -> cmsPeriodPricer.presentValue(x, ratesProvider, swaptionVolatilities)) .reduce((c1, c2) -> c1.plus(c2)) .orElse(CurrencyAmount.zero(cmsLeg.getCurrency())); } SabrExtrapolationReplicationCmsLegPricer(SabrExtrapolationReplicationCmsPeriodPricer cmsPeriodPricer); CurrencyAmount presentValue(
      ResolvedCmsLeg cmsLeg,
      RatesProvider ratesProvider,
      SabrSwaptionVolatilities swaptionVolatilities); ExplainMap explainPresentValue(
      ResolvedCmsLeg cmsLeg,
      RatesProvider provider,
      SabrSwaptionVolatilities volatilities); PointSensitivityBuilder presentValueSensitivityRates(
      ResolvedCmsLeg cmsLeg,
      RatesProvider ratesProvider,
      SabrSwaptionVolatilities swaptionVolatilities); PointSensitivityBuilder presentValueSensitivityModelParamsSabr(
      ResolvedCmsLeg cmsLeg,
      RatesProvider ratesProvider,
      SabrSwaptionVolatilities swaptionVolatilities); double presentValueSensitivityStrike(
      ResolvedCmsLeg cmsLeg,
      RatesProvider ratesProvider,
      SabrSwaptionVolatilities swaptionVolatilities); CurrencyAmount currentCash(
      ResolvedCmsLeg cmsLeg,
      RatesProvider ratesProvider,
      SabrSwaptionVolatilities swaptionVolatilities);  }### Answer:
@Test public void test_currentCash() { CurrencyAmount computed = LEG_PRICER.currentCash(FLOOR_LEG, RATES_PROVIDER, VOLATILITIES); assertThat(computed).isEqualTo(CurrencyAmount.zero(EUR)); }
@Test public void test_currentCash_onPay() { CurrencyAmount computed = LEG_PRICER.currentCash(CAP_LEG, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY); assertThat(computed.getAmount()).isCloseTo(NOTIONAL_VALUE_1 * (OBS_INDEX - CAP_VALUE) * 367d / 360d, offset(NOTIONAL_VALUE_0 * TOL)); }
@Test public void test_currentCash_twoPayments() { ResolvedCmsLeg leg = ResolvedCmsLeg.builder() .cmsPeriods(FLOOR_LEG.getCmsPeriods().get(1), CAP_LEG.getCmsPeriods().get(1)) .payReceive(RECEIVE) .build(); CurrencyAmount computed = LEG_PRICER.currentCash(leg, RATES_PROVIDER_ON_PAY, VOLATILITIES_ON_PAY); assertThat(computed.getAmount()).isCloseTo(NOTIONAL_VALUE_1 * (OBS_INDEX - CAP_VALUE + FLOOR_VALUE_1 - OBS_INDEX) * 367d / 360d, offset(NOTIONAL_VALUE_0 * TOL)); }