}
}
@Test
public void testCDSWithinCurves() {
CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true)
.withMaturityDate(YC_DATES[YC_DATES.length - 1].minusMonths(1))
.withEffectiveDate(VALUATION_DATE.minusMonths(1).plusDays(1))
.withStartDate(VALUATION_DATE.minusMonths(1));
final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(YIELD_CURVE, HAZARD_RATE_CURVE);
ZonedDateTime startDate = getStartDate(cds);
ZonedDateTime endDate = cds.getMaturityDate();
double[] actual = CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, CURVES);
double[] dep = DEPRECATED_CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, YIELD_CURVE, HAZARD_RATE_CURVE);
int nActual = actual.length;
int nDep = dep.length;
assertEquals(nDep, nActual);
for (int i = 0; i < nDep; ++i) {
assertEquals(actual[i], dep[i]);
}
cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(false)
.withMaturityDate(YC_DATES[YC_DATES.length - 1].minusMonths(1))
.withEffectiveDate(VALUATION_DATE.minusMonths(1).plusDays(1))
.withStartDate(VALUATION_DATE.minusMonths(1));
startDate = getStartDate(cds);
endDate = cds.getMaturityDate();
actual = CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, CURVES);
dep = DEPRECATED_CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, YIELD_CURVE, HAZARD_RATE_CURVE);
nActual = actual.length;
nDep = dep.length;
assertEquals(nDep, nActual);