### Question:
DiscountingCmsTradePricer { public MultiCurrencyAmount currentCash( ResolvedCmsTrade trade, RatesProvider ratesProvider) { MultiCurrencyAmount ccCms = productPricer.currentCash(trade.getProduct(), ratesProvider); if (!trade.getPremium().isPresent()) { return ccCms; } Payment premium = trade.getPremium().get(); if (premium.getDate().equals(ratesProvider.getValuationDate())) { ccCms = ccCms.plus(premium.getCurrency(), premium.getAmount()); } return ccCms; } DiscountingCmsTradePricer(DiscountingSwapProductPricer swapPricer, DiscountingPaymentPricer paymentPricer); MultiCurrencyAmount presentValue(
      ResolvedCmsTrade trade,
      RatesProvider ratesProvider); PointSensitivities presentValueSensitivity(
      ResolvedCmsTrade trade,
      RatesProvider ratesProvider); MultiCurrencyAmount currencyExposure(
      ResolvedCmsTrade trade,
      RatesProvider ratesProvider); MultiCurrencyAmount currentCash(
      ResolvedCmsTrade trade,
      RatesProvider ratesProvider); static final DiscountingCmsTradePricer DEFAULT; }### Answer:
@Test public void test_currentCash() { MultiCurrencyAmount cc1 = TRADE_PRICER.currentCash(CMS_TRADE_PREMIUM, RATES_PROVIDER); MultiCurrencyAmount cc2 = TRADE_PRICER.currentCash(CMS_TRADE, RATES_PROVIDER); assertThat(cc1).isEqualTo(MultiCurrencyAmount.of(PREMIUM.getValue())); assertThat(cc2).isEqualTo(MultiCurrencyAmount.of(CurrencyAmount.zero(EUR))); }
@Test public void test_currentCash_onPay() { MultiCurrencyAmount cc1 = TRADE_PRICER.currentCash(CMS_TRADE_PREMIUM, RATES_PROVIDER_ON_PAY); MultiCurrencyAmount cc2 = TRADE_PRICER.currentCash(CMS_TRADE, RATES_PROVIDER_ON_PAY); MultiCurrencyAmount ccProd1 = PRODUCT_PRICER.currentCash(CMS_ONE_LEG, RATES_PROVIDER_ON_PAY); MultiCurrencyAmount ccProd2 = PRODUCT_PRICER.currentCash(CMS_TWO_LEGS, RATES_PROVIDER_ON_PAY); assertThat(cc1).isEqualTo(ccProd1); assertThat(cc2).isEqualTo(ccProd2); }