@Test
/**
* Tests the present value curve sensitivity cap/floor parity (Cap - Floor = (cms1 - cms2) - strike).
*/
public void presentValueCurveSensitivityCapFloorParity() {
MultipleCurrencyMulticurveSensitivity pvcsCapLong = METHOD_CMS_SPREAD.presentValueCurveSensitivity(CMS_CAP_SPREAD, SABR_MULTICURVES);
pvcsCapLong = pvcsCapLong.cleaned();
MultipleCurrencyMulticurveSensitivity pvcsFloorLong = METHOD_CMS_SPREAD.presentValueCurveSensitivity(CMS_FLOOR_SPREAD, SABR_MULTICURVES);
pvcsFloorLong = pvcsFloorLong.cleaned();
final CouponCMS cms1 = new CouponCMS(EUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, FIXING_TIME, SWAP_1, SETTLEMENT_TIME);
final CouponCMS cms2 = new CouponCMS(EUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, FIXING_TIME, SWAP_2, SETTLEMENT_TIME);
final CouponFixed cpnStrike = new CouponFixed(EUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, STRIKE);
MultipleCurrencyMulticurveSensitivity pvcsCMS1 = METHOD_CMS_COUPON.presentValueCurveSensitivity(cms1, SABR_MULTICURVES);
pvcsCMS1 = pvcsCMS1.cleaned();
MultipleCurrencyMulticurveSensitivity pvcsCMS2 = METHOD_CMS_COUPON.presentValueCurveSensitivity(cms2, SABR_MULTICURVES);
pvcsCMS2 = pvcsCMS2.cleaned();
final MultipleCurrencyMulticurveSensitivity pvcsStrike = METHOD_CPN_FIXED.presentValueCurveSensitivity(cpnStrike, MULTICURVES);
MultipleCurrencyMulticurveSensitivity pvcsParity1 = pvcsCMS1.plus(pvcsCMS2.plus(pvcsStrike).multipliedBy(-1));
pvcsParity1 = pvcsParity1.cleaned();
MultipleCurrencyMulticurveSensitivity pvcsParity2 = pvcsCapLong.plus(pvcsFloorLong.multipliedBy(-1));
pvcsParity2 = pvcsParity2.cleaned();
AssertSensivityObjects.assertEquals("CMS spread: curve sensitivity - Cap/Floor parity", pvcsParity1, pvcsParity2, TOLERANCE_PV);
}