final double[] mainIbor = new double[] {0.0, factor, 0.0};
final double[] floorIbor = new double[] {0.0, 0.0, factor * strike};
final double[] capIbor = new double[] {0.0, 0.0, +50.0};
final AnnuityCouponIborRatchetDefinition ratchetFixedDefinition = AnnuityCouponIborRatchetDefinition.withFirstCouponFixed(SETTLEMENT_DATE, ANNUITY_TENOR, NOTIONAL, EURIBOR3M, IS_PAYER,
FIRST_CPN_RATE, mainIbor, floorIbor, capIbor, TARGET);
final AnnuityCouponIborRatchet ratchetFixed = ratchetFixedDefinition.toDerivative(REFERENCE_DATE, FIXING_TS);
final AnnuityCapFloorIborDefinition capDefinition = AnnuityCapFloorIborDefinition.from(SETTLEMENT_DATE, SETTLEMENT_DATE.plus(ANNUITY_TENOR), NOTIONAL, EURIBOR3M, IS_PAYER, strike, true, TARGET);
final Annuity<? extends Payment> cap = capDefinition.toDerivative(REFERENCE_DATE, FIXING_TS);
final int nbPath = 100000;
HullWhiteMonteCarloMethod methodMC;
methodMC = new HullWhiteMonteCarloMethod(new NormalRandomNumberGenerator(0.0, 1.0, new MersenneTwister()), nbPath);
final MultipleCurrencyAmount pvFloorMC = methodMC.presentValue(ratchetFixed, CUR, HW_MULTICURVES);
final AnnuityCouponFixedDefinition fixedDefinition = AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, ANNUITY_TENOR, EURIBOR3M.getTenor(), TARGET, EURIBOR3M.getDayCount(),
EURIBOR3M.getBusinessDayConvention(), EURIBOR3M.isEndOfMonth(), NOTIONAL, strike, IS_PAYER);
final AnnuityCouponFixed fixed = fixedDefinition.toDerivative(REFERENCE_DATE);
MultipleCurrencyAmount pvFlooredExpected = MultipleCurrencyAmount.of(CUR, 0.0);
pvFlooredExpected = pvFlooredExpected.plus(ratchetFixed.getNthPayment(0).accept(PVDC, MULTICURVES));
for (int loopcpn = 1; loopcpn < cap.getNumberOfPayments(); loopcpn++) {
pvFlooredExpected = pvFlooredExpected.plus(METHOD_HW_CAP.presentValue((CapFloorIbor) cap.getNthPayment(loopcpn), HW_MULTICURVES).multipliedBy(factor));
pvFlooredExpected = pvFlooredExpected.plus(fixed.getNthPayment(loopcpn).accept(PVDC, MULTICURVES).multipliedBy(factor));
}
assertEquals("Annuity Ratchet Ibor - Hull-White - Monte Carlo - Degenerate in floor leg", pvFlooredExpected.getAmount(CUR), pvFloorMC.getAmount(CUR), 2.5E+3);