### Question:
DiscountingCmsTradePricer { public MultiCurrencyAmount presentValue( ResolvedCmsTrade trade, RatesProvider ratesProvider) { MultiCurrencyAmount pvCms = productPricer.presentValue(trade.getProduct(), ratesProvider); if (!trade.getPremium().isPresent()) { return pvCms; } CurrencyAmount pvPremium = paymentPricer.presentValue(trade.getPremium().get(), ratesProvider); return pvCms.plus(pvPremium); } 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_presentValue() { MultiCurrencyAmount pv1 = TRADE_PRICER.presentValue(CMS_TRADE_PREMIUM, RATES_PROVIDER); MultiCurrencyAmount pv2 = TRADE_PRICER.presentValue(CMS_TRADE, RATES_PROVIDER); MultiCurrencyAmount pvProd1 = PRODUCT_PRICER.presentValue(CMS_ONE_LEG, RATES_PROVIDER); MultiCurrencyAmount pvProd2 = PRODUCT_PRICER.presentValue(CMS_TWO_LEGS, RATES_PROVIDER); CurrencyAmount pvPrem = PREMIUM_PRICER.presentValue(PREMIUM, RATES_PROVIDER); assertThat(pv1).isEqualTo(pvProd1.plus(pvPrem)); assertThat(pv2).isEqualTo(pvProd2); }