@Test(enabled = true)
 /**
  * Tests to estimate the impact of mu on the CMS coupon pricing. "enabled = false" for the
  * standard testing.
  */
 public void testPriceMultiMu() {
   final double[] mu = new double[] {1.10, 1.30, 1.55, 2.25, 3.50, 6.00, 15.0};
   final int nbMu = mu.length;
   final double priceCouponStd =
       METHOD_STANDARD_CPN.presentValue(CMS_COUPON, SABR_MULTICURVES).getAmount(EUR);
   @SuppressWarnings("unused")
   final double rateCouponStd =
       priceCouponStd
           / (CMS_COUPON.getPaymentYearFraction()
               * CMS_COUPON.getNotional()
               * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime()));
   final double[] priceCouponExtra = new double[nbMu];
   final double[] rateCouponExtra = new double[nbMu];
   for (int loopmu = 0; loopmu < nbMu; loopmu++) {
     final CouponCMSSABRExtrapolationRightReplicationMethod methodExtrapolation =
         new CouponCMSSABRExtrapolationRightReplicationMethod(CUT_OFF_STRIKE, mu[loopmu]);
     priceCouponExtra[loopmu] =
         methodExtrapolation.presentValue(CMS_COUPON, SABR_MULTICURVES).getAmount(EUR);
     rateCouponExtra[loopmu] =
         priceCouponExtra[loopmu]
             / (CMS_COUPON.getPaymentYearFraction()
                 * CMS_COUPON.getNotional()
                 * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime()));
   }
   final double priceCouponNoAdj =
       METHOD_DSC_CPN.presentValue(CMS_COUPON, MULTICURVES).getAmount(EUR);
   final double rateCouponNoAdj =
       priceCouponNoAdj
           / (CMS_COUPON.getPaymentYearFraction()
               * CMS_COUPON.getNotional()
               * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime()));
   for (int loopmu = 1; loopmu < nbMu; loopmu++) {
     assertTrue(
         "Extrapolation: comparison with standard method",
         rateCouponExtra[loopmu - 1] > rateCouponExtra[loopmu]);
   }
   assertTrue(
       "Extrapolation: comparison with standard method",
       rateCouponExtra[nbMu - 1] > rateCouponNoAdj);
 }
 /**
  * Test the present value for a CMS coupon with pricing by replication in the SABR with
  * extrapolation framework. The present value is tested against hard-coded value and cap of strike
  * 0.
  */
 public void presentValue() {
   // CMS cap/floor with strike 0 has the same price as a CMS coupon.
   final double priceCouponStd =
       METHOD_STANDARD_CPN.presentValue(CMS_COUPON, SABR_MULTICURVES).getAmount(EUR).getAmount();
   final double rateCouponStd =
       priceCouponStd
           / (CMS_COUPON.getPaymentYearFraction()
               * CMS_COUPON.getNotional()
               * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime()));
   final double priceCouponExtra =
       METHOD_EXTRAPOLATION_CPN
           .presentValue(CMS_COUPON, SABR_MULTICURVES)
           .getAmount(EUR)
           .getAmount();
   final double rateCouponExtra =
       priceCouponExtra
           / (CMS_COUPON.getPaymentYearFraction()
               * CMS_COUPON.getNotional()
               * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime()));
   final double priceCouponNoAdj =
       METHOD_DSC_CPN.presentValue(CMS_COUPON, MULTICURVES).getAmount(EUR).getAmount();
   final double rateCouponNoAdj =
       priceCouponNoAdj
           / (CMS_COUPON.getPaymentYearFraction()
               * CMS_COUPON.getNotional()
               * MULTICURVES.getDiscountFactor(EUR, CMS_COUPON.getPaymentTime()));
   assertEquals(
       "Extrapolation: comparison with standard method", rateCouponStd > rateCouponExtra, true);
   assertEquals(
       "Extrapolation: comparison with no convexity adjustment",
       rateCouponExtra > rateCouponNoAdj,
       true);
   final double rateCouponExtraExpected = 0.0189864; // From previous run.
   assertEquals("Extrapolation: hard-coded value", rateCouponExtraExpected, rateCouponExtra, 1E-6);
   final double priceCap0Extra =
       METHOD_EXTRAPOLATION_CAP
           .presentValue(CMS_CAP_0, SABR_MULTICURVES)
           .getAmount(EUR)
           .getAmount();
   assertEquals(
       "Extrapolation: CMS coupon vs Cap 0", priceCouponExtra, priceCap0Extra, TOLERANCE_PV);
 }
 /** Tests the coupon present value SABR parameters sensitivity vs finite difference. */
 public void presentValueSABRSensitivityCoupon() {
   final double pv =
       METHOD_EXTRAPOLATION_CPN
           .presentValue(CMS_COUPON, SABR_MULTICURVES)
           .getAmount(EUR)
           .getAmount();
   final PresentValueSABRSensitivityDataBundle pvsCpn =
       METHOD_EXTRAPOLATION_CPN.presentValueSABRSensitivity(CMS_COUPON, SABR_MULTICURVES);
   // SABR sensitivity vs finite difference
   final double shift = 0.0001;
   final double shiftAlpha = 0.00001;
   final double maturity =
       CMS_COUPON
               .getUnderlyingSwap()
               .getFixedLeg()
               .getNthPayment(
                   CMS_COUPON.getUnderlyingSwap().getFixedLeg().getNumberOfPayments() - 1)
               .getPaymentTime()
           - CMS_COUPON.getSettlementTime();
   final DoublesPair expectedExpiryTenor = DoublesPair.of(CMS_COUPON.getFixingTime(), maturity);
   // Alpha sensitivity vs finite difference computation
   final SABRInterestRateParameters sabrParameterAlphaBumped =
       SABRDataSets.createSABR1AlphaBumped(shiftAlpha);
   final SABRSwaptionProviderDiscount sabrBundleAlphaBumped =
       new SABRSwaptionProviderDiscount(MULTICURVES, sabrParameterAlphaBumped, EUR1YEURIBOR6M);
   final double pvLongPayerAlphaBumped =
       METHOD_EXTRAPOLATION_CPN
           .presentValue(CMS_COUPON, sabrBundleAlphaBumped)
           .getAmount(EUR)
           .getAmount();
   final double expectedAlphaSensi = (pvLongPayerAlphaBumped - pv) / shiftAlpha;
   assertEquals("Number of alpha sensitivity", pvsCpn.getAlpha().getMap().keySet().size(), 1);
   assertEquals(
       "Alpha sensitivity expiry/tenor",
       pvsCpn.getAlpha().getMap().keySet().contains(expectedExpiryTenor),
       true);
   assertEquals(
       "Alpha sensitivity value",
       expectedAlphaSensi,
       pvsCpn.getAlpha().getMap().get(expectedExpiryTenor),
       TOLERANCE_PV_DELTA);
   // Rho sensitivity vs finite difference computation
   final SABRInterestRateParameters sabrParameterRhoBumped = SABRDataSets.createSABR1RhoBumped();
   final SABRSwaptionProviderDiscount sabrBundleRhoBumped =
       new SABRSwaptionProviderDiscount(MULTICURVES, sabrParameterRhoBumped, EUR1YEURIBOR6M);
   final double pvLongPayerRhoBumped =
       METHOD_EXTRAPOLATION_CPN
           .presentValue(CMS_COUPON, sabrBundleRhoBumped)
           .getAmount(EUR)
           .getAmount();
   final double expectedRhoSensi = (pvLongPayerRhoBumped - pv) / shift;
   assertEquals("Number of rho sensitivity", pvsCpn.getRho().getMap().keySet().size(), 1);
   assertEquals(
       "Rho sensitivity expiry/tenor",
       pvsCpn.getRho().getMap().keySet().contains(expectedExpiryTenor),
       true);
   assertEquals(
       "Rho sensitivity value",
       expectedRhoSensi,
       pvsCpn.getRho().getMap().get(expectedExpiryTenor),
       TOLERANCE_PV_DELTA);
   // Nu sensitivity vs finite difference computation
   final SABRInterestRateParameters sabrParameterNuBumped = SABRDataSets.createSABR1NuBumped();
   final SABRSwaptionProviderDiscount sabrBundleNuBumped =
       new SABRSwaptionProviderDiscount(MULTICURVES, sabrParameterNuBumped, EUR1YEURIBOR6M);
   final double pvLongPayerNuBumped =
       METHOD_EXTRAPOLATION_CPN
           .presentValue(CMS_COUPON, sabrBundleNuBumped)
           .getAmount(EUR)
           .getAmount();
   final double expectedNuSensi = (pvLongPayerNuBumped - pv) / shift;
   assertEquals("Number of nu sensitivity", pvsCpn.getNu().getMap().keySet().size(), 1);
   assertTrue(
       "Nu sensitivity expiry/tenor",
       pvsCpn.getNu().getMap().keySet().contains(expectedExpiryTenor));
   assertEquals(
       "Nu sensitivity value",
       expectedNuSensi,
       pvsCpn.getNu().getMap().get(expectedExpiryTenor),
       TOLERANCE_PV_DELTA);
 }