public void test_presentValue() {
   MultiCurrencyAmount pvSensiTrade =
       PRICER_TRADE.presentValue(OPTION_TRADE, RATES_PROVIDER, VOLS);
   CurrencyAmount pvSensiProduct =
       PRICER_PRODUCT.presentValue(OPTION_PRODUCT, RATES_PROVIDER, VOLS);
   CurrencyAmount pvSensiPremium = PRICER_PAYMENT.presentValue(PREMIUM, RATES_PROVIDER);
   assertEquals(pvSensiTrade, MultiCurrencyAmount.of(pvSensiProduct, pvSensiPremium));
 }
 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);
   assertEquals(pv1, pvProd1.plus(pvPrem));
   assertEquals(pv2, pvProd2);
 }
 public void test_presentValueSensitivity() {
   PointSensitivities pvSensiTrade =
       PRICER_TRADE.presentValueSensitivityRates(OPTION_TRADE, RATES_PROVIDER, VOLS);
   PointSensitivities pvSensiProduct =
       PRICER_PRODUCT.presentValueSensitivityRates(OPTION_PRODUCT, RATES_PROVIDER, VOLS);
   PointSensitivities pvSensiPremium =
       PRICER_PAYMENT.presentValueSensitivity(PREMIUM, RATES_PROVIDER).build();
   assertEquals(pvSensiTrade, pvSensiProduct.combinedWith(pvSensiPremium));
 }
 public void test_presentValueSensitivity() {
   PointSensitivities pt1 =
       TRADE_PRICER.presentValueSensitivity(CMS_TRADE_PREMIUM, RATES_PROVIDER);
   PointSensitivities pt2 = TRADE_PRICER.presentValueSensitivity(CMS_TRADE, RATES_PROVIDER);
   PointSensitivityBuilder ptProd1 =
       PRODUCT_PRICER.presentValueSensitivity(CMS_ONE_LEG, RATES_PROVIDER);
   PointSensitivityBuilder ptProd2 =
       PRODUCT_PRICER.presentValueSensitivity(CMS_TWO_LEGS, RATES_PROVIDER);
   PointSensitivityBuilder ptPrem =
       PREMIUM_PRICER.presentValueSensitivity(PREMIUM, RATES_PROVIDER);
   assertEquals(pt1, ptProd1.combinedWith(ptPrem).build());
   assertEquals(pt2, ptProd2.build());
 }
 public void test_presentValue_noExcoupon() {
   CurrencyAmount computed = PRICER.presentValue(PRODUCT_NO_EXCOUPON, PROVIDER);
   ExpandedFixedCouponBond expanded = PRODUCT.expand();
   CurrencyAmount expected =
       PRICER_NOMINAL.presentValue(expanded.getNominalPayment(), DSC_FACTORS_ISSUER);
   int size = expanded.getPeriodicPayments().size();
   double pvcCupon = 0d;
   for (int i = 2; i < size; ++i) {
     FixedCouponBondPaymentPeriod payment = expanded.getPeriodicPayments().get(i);
     pvcCupon +=
         PRICER_COUPON.presentValue(
             payment, IssuerCurveDiscountFactors.of(DSC_FACTORS_ISSUER, GROUP_ISSUER));
   }
   expected = expected.plus(pvcCupon);
   assertEquals(computed.getCurrency(), EUR);
   assertEquals(computed.getAmount(), expected.getAmount(), NOTIONAL * TOL);
 }