public void presentValueFromZSpread() {
final double pv = METHOD.presentValue(BOND_FIXED_SECURITY_1, CURVES);
double zSpread = 0.0;
final double pvZ0 = METHOD.presentValueFromZSpread(BOND_FIXED_SECURITY_1, CURVES, zSpread);
assertEquals("Fixed coupon bond security: present value from z-spread", pv, pvZ0, TOLERANCE_PRICE);
final YieldCurveBundle shiftedBundle = new YieldCurveBundle();
shiftedBundle.addAll(CURVES);
YieldAndDiscountCurve shiftedCredit = CURVES.getCurve(CREDIT_CURVE_NAME).withParallelShift(zSpread);
shiftedBundle.replaceCurve(CREDIT_CURVE_NAME, shiftedCredit);
double pvZ = METHOD.presentValueFromZSpread(BOND_FIXED_SECURITY_1, CURVES, zSpread);
double pvZExpected = METHOD.presentValue(BOND_FIXED_SECURITY_1, shiftedBundle);
assertEquals("Fixed coupon bond security: present value from z-spread", pvZExpected, pvZ, TOLERANCE_PRICE);
zSpread = 0.0010; // 10bps
shiftedCredit = CURVES.getCurve(CREDIT_CURVE_NAME).withParallelShift(zSpread);
shiftedBundle.replaceCurve(CREDIT_CURVE_NAME, shiftedCredit);
pvZ = METHOD.presentValueFromZSpread(BOND_FIXED_SECURITY_1, CURVES, zSpread);
pvZExpected = METHOD.presentValue(BOND_FIXED_SECURITY_1, shiftedBundle);
assertEquals("Fixed coupon bond security: present value from z-spread", pvZExpected, pvZ, TOLERANCE_PRICE);
final double pvZ2 = METHOD.presentValueFromZSpread(BOND_FIXED_SECURITY_1, CURVES, zSpread);
assertEquals("Fixed coupon bond security: present value from z-spread", pvZ, pvZ2, 1E-8);