@Test(expectedExceptions = IllegalArgumentException.class)
 public void nullCurveTest() {
   final CreditDefaultSwapDefinition cds =
       CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinition()
           .withMaturityDate(VALUATION_DATE.plusYears(10));
   final ISDAYieldCurveAndHazardRateCurveProvider cv = null;
   CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, cv);
 }
 @Test
 public void testNonOverlappingHazardRateAndYieldCurveDates() {
   final ZonedDateTime[] hrDates = new ZonedDateTime[HR_DATES.length];
   final double[] hrTimes = new double[HR_TIMES.length];
   for (int i = 0; i < HR_DATES.length; i++) {
     hrDates[i] = HR_DATES[i].plusDays(12);
     hrTimes[i] = DAY_COUNT.getDayCountFraction(BASE_DATE, hrDates[i]);
   }
   final HazardRateCurve hazardRateCurve = new HazardRateCurve(hrDates, hrTimes, HR_RATES, OFFSET);
   final ZonedDateTime[] expected = new ZonedDateTime[hrDates.length + YC_DATES.length + 2];
   for (int i = 0; i < YC_DATES.length; i++) {
     expected[i * 2 + 1] = YC_DATES[i];
   }
   for (int i = 0; i < hrDates.length; i++) {
     expected[i * 2 + 2] = hrDates[i];
   }
   CreditDefaultSwapDefinition cds =
       CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true)
           .withMaturityDate(VALUATION_DATE.plusYears(50));
   final ISDAYieldCurveAndHazardRateCurveProvider curves =
       new ISDAYieldCurveAndHazardRateCurveProvider(YIELD_CURVE, hazardRateCurve);
   ZonedDateTime[] actual =
       CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, curves);
   expected[0] = cds.getStartDate();
   expected[expected.length - 1] = cds.getMaturityDate().plusDays(1);
   assertDateArrayEquals(expected, actual);
   assertDateArrayEquals(
       expected,
       DEPRECATED_CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(
           VALUATION_DATE, cds, YIELD_CURVE, hazardRateCurve, false));
   cds =
       CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(false)
           .withMaturityDate(VALUATION_DATE.plusYears(50));
   actual = CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, curves);
   expected[0] = cds.getStartDate();
   expected[expected.length - 1] = cds.getMaturityDate();
   assertDateArrayEquals(expected, actual);
   assertDateArrayEquals(
       expected,
       DEPRECATED_CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(
           VALUATION_DATE, cds, YIELD_CURVE, hazardRateCurve, false));
 }
 @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[] actual =
       CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, CURVES);
   ZonedDateTime[] expected = new ZonedDateTime[YC_DATES.length + 1];
   for (int i = 0; i < YC_DATES.length; i++) {
     expected[i + 1] = YC_DATES[i];
   }
   expected[0] = cds.getStartDate();
   expected[YC_DATES.length] = cds.getMaturityDate().plusDays(1);
   assertDateArrayEquals(expected, actual);
   assertDateArrayEquals(
       expected,
       DEPRECATED_CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(
           VALUATION_DATE, cds, YIELD_CURVE, HAZARD_RATE_CURVE, false));
   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));
   actual = CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, CURVES);
   expected = new ZonedDateTime[YC_DATES.length + 1];
   for (int i = 0; i < YC_DATES.length; i++) {
     expected[i + 1] = YC_DATES[i];
   }
   expected[0] = cds.getStartDate();
   expected[YC_DATES.length] = cds.getMaturityDate();
   assertDateArrayEquals(expected, actual);
   assertDateArrayEquals(
       expected,
       DEPRECATED_CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(
           VALUATION_DATE, cds, YIELD_CURVE, HAZARD_RATE_CURVE, false));
 }