final double deltaTolerancePrice = 1.0E+2;
//Testing note: Sensitivity is for a movement of 1. 1E+2 = 0.01 unit for a 1 bp move.
final double deltaShift = 1.0E-6;
// Credit curve sensitivity
final String bumpedCurveName = "Bumped Curve";
BillTransaction billBumped = BILL_TRA_DEFINITION.toDerivative(REFERENCE_DATE, NAME_CURVES[0], bumpedCurveName);
final double[] nodeTimesCre = new double[] {billBumped.getBillPurchased().getEndTime() };
final double[] sensi = SensitivityFiniteDifference.curveSensitivity(billBumped, CURVE_BUNDLE, NAME_CURVES[1], bumpedCurveName, nodeTimesCre, deltaShift, METHOD_TRANSACTION);
final List<DoublesPair> sensiPv = pvcsComputed.getSensitivities().get(NAME_CURVES[1]);
for (int loopnode = 0; loopnode < sensi.length; loopnode++) {
final DoublesPair pairPv = sensiPv.get(loopnode);
assertEquals("Bill Security: curve sensitivity - Node " + loopnode, nodeTimesCre[loopnode], pairPv.getFirst(), 1E-8);
AssertJUnit.assertEquals("Bill Security: curve sensitivity", pairPv.second, sensi[loopnode], deltaTolerancePrice);
}
// Discounting curve sensitivity
billBumped = BILL_TRA_DEFINITION.toDerivative(REFERENCE_DATE, bumpedCurveName, NAME_CURVES[1]);
final double[] nodeTimesDsc = new double[] {billBumped.getBillPurchased().getSettlementTime() };
final double[] sensiDsc = SensitivityFiniteDifference.curveSensitivity(billBumped, CURVE_BUNDLE, NAME_CURVES[0], bumpedCurveName, nodeTimesDsc, deltaShift, METHOD_TRANSACTION);
final List<DoublesPair> sensiDscPv = pvcsComputed.getSensitivities().get(NAME_CURVES[0]);
for (int loopnode = 0; loopnode < sensiDsc.length; loopnode++) {
final DoublesPair pairPv = sensiDscPv.get(loopnode);
assertEquals("Bill Security: curve sensitivity - Node " + loopnode, nodeTimesDsc[loopnode], pairPv.getFirst(), 1E-8);