### Question:
IsdaHomogenousCdsIndexProductPricer { public CurrencyAmount expectedLoss( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider) { if (isExpired(cdsIndex, ratesProvider)) { return CurrencyAmount.of(cdsIndex.getCurrency(), 0d); } ResolvedCds cds = cdsIndex.toSingleNameCds(); double recoveryRate = underlyingPricer.recoveryRate(cds, ratesProvider); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double survivalProbability = rates.getSecond().survivalProbability(cds.getProtectionEndDate()); double el = (1d - recoveryRate) * (1d - survivalProbability) * rates.getThird(); return CurrencyAmount.of(cds.getCurrency(), Math.abs(cds.getNotional()) * el); } IsdaHomogenousCdsIndexProductPricer(AccrualOnDefaultFormula formula); AccrualOnDefaultFormula getAccrualOnDefaultFormula(); double price(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      PriceType priceType,
      ReferenceData refData); PointSensitivityBuilder priceSensitivity(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); CurrencyAmount presentValue(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      PriceType priceType,
      ReferenceData refData); PointSensitivityBuilder presentValueSensitivity(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); double parSpread(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); PointSensitivityBuilder parSpreadSensitivity(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); CurrencyAmount rpv01(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      PriceType priceType,
      ReferenceData refData); double riskyAnnuity(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      PriceType priceType,
      ReferenceData refData); PointSensitivityBuilder riskyAnnuitySensitivity(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); CurrencyAmount recovery01(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); JumpToDefault jumpToDefault(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider,
      LocalDate referenceDate,
      ReferenceData refData); CurrencyAmount expectedLoss(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider); static final IsdaHomogenousCdsIndexProductPricer DEFAULT; }### Answer:
@Test public void expectedLossTest() { CurrencyAmount computed = PRICER.expectedLoss(PRODUCT, RATES_PROVIDER); double survivalProbability = RATES_PROVIDER.survivalProbabilities(INDEX_ID, USD).survivalProbability(PRODUCT.getProtectionEndDate()); double expected = (1d - RECOVERY_RATE) * (1d - survivalProbability) * NOTIONAL * INDEX_FACTOR; assertThat(computed.getCurrency()).isEqualTo(USD); assertThat(computed.getAmount()).isCloseTo(expected, offset(NOTIONAL * TOL)); }