* <p>
* Note: It is this calibration that is causing the exception.
*/
@Test(expectedExceptions = OpenGammaRuntimeException.class)
public void testRecoveryRateEqualsOneWithZeroSpreadsProvided() {
final LegacyVanillaCreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithRecoveryRate(1).withMaturityDate(
VALUATION_DATE.plusYears(10));
final double riskyAnnuity = CALCULATOR.calculatePremiumLeg(VALUATION_DATE, cds, YIELD_CURVE, HAZARD_CURVE, PriceType.CLEAN);
final double cleanPremiumLeg = -riskyAnnuity * cds.getParSpread() / BP;
final double dirtyPremiumLeg = -CALCULATOR.calculatePremiumLeg(VALUATION_DATE, cds, YIELD_CURVE, HAZARD_CURVE, PriceType.DIRTY) * cds.getParSpread() / BP;
final double cleanPrice = CALCULATOR.calibrateAndGetPresentValue(VALUATION_DATE, cds, MARKET_TENORS, ZERO_SPREADS, YIELD_CURVE, PriceType.CLEAN);
final double dirtyPrice = CALCULATOR.calibrateAndGetPresentValue(VALUATION_DATE, cds, MARKET_TENORS, ZERO_SPREADS, YIELD_CURVE, PriceType.DIRTY);
assertEquals(cleanPremiumLeg / cleanPrice, 1.0, EPS);
assertEquals(dirtyPremiumLeg / dirtyPrice, 1.0, EPS);
}