DefaultLegacyCdsMarketDataResolverFn implements LegacyCdsMarketDataResolverFn { @Override public Result<CreditCurveDataKey> resolve(Environment env, LegacyCDSSecurity security) { ExternalId referenceEntity = security.getReferenceEntity(); SeniorityLevel seniority = security.getSeniority(); RestructuringClause restructuringClause = security.getRestructuringClause(); Currency currency = security.getNotional().getCurrency(); CreditCurveDataKey key = CreditCurveDataKey.builder() .currency(currency) .curveName(referenceEntity.getValue()) .seniority(seniority) .restructuring(restructuringClause) .cdsType(CreditDefaultSwapType.SINGLE_NAME) .build(); return _creditKeyMapperFn.getMapping(key); } DefaultLegacyCdsMarketDataResolverFn(CreditKeyMapperFn creditKeyMapperFn); @Override Result<CreditCurveDataKey> resolve(Environment env, LegacyCDSSecurity security);  }
@Test public void resolve() { Result<CreditCurveDataKey> result = _fn.resolve(_env, _sec); assertTrue("Expected success", result.isSuccess()); CreditCurveDataKey key = result.getValue(); assertEquals(_clause, key.getRestructuring()); assertEquals(_seniority, key.getSeniority()); assertEquals(_ccy, key.getCurrency()); assertEquals(_refEntity.getValue(), key.getCurveName()); }