@Test
 /** Test the present value using the method with the direct formula with extrapolation. */
 public void presentValueCurveSensitivityMethodVsCalculator() {
   final SABRInterestRateDataBundle sabrExtraBundle =
       new SABRInterestRateDataBundle(SABR_PARAMETERS, CURVES);
   final InterestRateCurveSensitivity pvsMethod =
       METHOD.presentValueSensitivity(CAP_HIGH_LONG, SABR_BUNDLE);
   final InterestRateCurveSensitivity pvsCalculator =
       new InterestRateCurveSensitivity(CAP_HIGH_LONG.accept(PVSC, sabrExtraBundle));
   assertEquals(
       "Cap/floor: SABR with extrapolation pv curve sensitivity - Method vs Calculator",
       pvsMethod,
       pvsCalculator);
 }
 @Test
 /**
  * Test the present value rate sensitivity against a finite difference computation; strike above
  * the cut-off strike. Test sensitivity long/short parity.
  */
 public void testPresentValueSensitivityAboveCutOff() {
   final YieldCurveBundle curves = TestsDataSetsSABR.createCurves1();
   final SABRInterestRateParameters sabrParameter = TestsDataSetsSABR.createSABR1();
   final SABRInterestRateDataBundle sabrBundle =
       new SABRInterestRateDataBundle(sabrParameter, curves);
   InterestRateCurveSensitivity pvsCapLong =
       METHOD.presentValueSensitivity(CAP_HIGH_LONG, sabrBundle);
   final InterestRateCurveSensitivity pvsCapShort =
       METHOD.presentValueSensitivity(CAP_HIGH_SHORT, sabrBundle);
   // Long/short parity
   final InterestRateCurveSensitivity pvsCapShort_1 = pvsCapShort.multipliedBy(-1);
   assertEquals(pvsCapLong.getSensitivities(), pvsCapShort_1.getSensitivities());
   // Present value sensitivity comparison with finite difference.
   final double deltaTolerancePrice = 1.0E-1;
   // Testing note: Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move.
   final double deltaShift = 1.0E-7;
   pvsCapLong = pvsCapLong.cleaned();
   final String bumpedCurveName = "Bumped Curve";
   // 1. Forward curve sensitivity
   final String[] CurveNameBumpedForward = {FUNDING_CURVE_NAME, bumpedCurveName};
   final CapFloorIbor capBumpedForward =
       (CapFloorIbor)
           CAP_HIGH_LONG_DEFINITION.toDerivative(REFERENCE_DATE, CurveNameBumpedForward);
   final double[] nodeTimesForward =
       new double[] {
         capBumpedForward.getFixingPeriodStartTime(), capBumpedForward.getFixingPeriodEndTime()
       };
   final double[] sensiForwardMethod =
       SensitivityFiniteDifference.curveSensitivity(
           capBumpedForward,
           SABR_BUNDLE,
           FORWARD_CURVE_NAME,
           bumpedCurveName,
           nodeTimesForward,
           deltaShift,
           METHOD);
   assertEquals(
       "Sensitivity finite difference method: number of node", 2, sensiForwardMethod.length);
   final List<DoublesPair> sensiPvForward = pvsCapLong.getSensitivities().get(FORWARD_CURVE_NAME);
   for (int loopnode = 0; loopnode < sensiForwardMethod.length; loopnode++) {
     final DoublesPair pairPv = sensiPvForward.get(loopnode);
     assertEquals(
         "Sensitivity cap/floor pv to forward curve: Node " + loopnode,
         nodeTimesForward[loopnode],
         pairPv.getFirst(),
         1E-8);
     //      assertEquals("Sensitivity finite difference method: node sensitivity: Node " +
     // loopnode, pairPv.second, sensiForwardMethod[loopnode], deltaTolerancePrice);
   }
   // 2. Discounting curve sensitivity
   final String[] CurveNameBumpedDisc = {bumpedCurveName, FORWARD_CURVE_NAME};
   final CapFloorIbor capBumpedDisc =
       (CapFloorIbor) CAP_HIGH_LONG_DEFINITION.toDerivative(REFERENCE_DATE, CurveNameBumpedDisc);
   final double[] nodeTimesDisc = new double[] {capBumpedDisc.getPaymentTime()};
   final double[] sensiDiscMethod =
       SensitivityFiniteDifference.curveSensitivity(
           capBumpedDisc,
           SABR_BUNDLE,
           FUNDING_CURVE_NAME,
           bumpedCurveName,
           nodeTimesDisc,
           deltaShift,
           METHOD);
   assertEquals("Sensitivity finite difference method: number of node", 1, sensiDiscMethod.length);
   final List<DoublesPair> sensiPvDisc = pvsCapLong.getSensitivities().get(FUNDING_CURVE_NAME);
   for (int loopnode = 0; loopnode < sensiDiscMethod.length; loopnode++) {
     final DoublesPair pairPv = sensiPvDisc.get(loopnode);
     assertEquals(
         "Sensitivity cap/floor pv to forward curve: Node " + loopnode,
         nodeTimesDisc[loopnode],
         pairPv.getFirst(),
         1E-8);
     assertEquals(
         "Sensitivity finite difference method: node sensitivity",
         pairPv.second,
         sensiDiscMethod[loopnode],
         deltaTolerancePrice);
   }
 }