DefaultBondCreditMarketDataResolverFn implements BondCreditMarketDataResolverFn { @Override public Result<CreditCurveDataKey> resolve(Environment env, BondSecurity bondSecurity) { ExternalIdBundle bondId = bondSecurity.getExternalIdBundle(); CreditCurveDataKey creditCurveDataKey = _keyMap.getKeyMap().get(bondId); if (creditCurveDataKey != null) { return Result.success(creditCurveDataKey); } else { return Result.failure(FailureStatus.ERROR, "Failed to resolve a mapping for bond id {}", bondId); } } DefaultBondCreditMarketDataResolverFn(BondCreditCurveDataKeyMap keyMap); @Override Result<CreditCurveDataKey> resolve(Environment env, BondSecurity bondSecurity);  }
@Test public void resolve() { Result<CreditCurveDataKey> result = _fn.resolve(_env, _goodSecurity); assertTrue(result.isSuccess()); }
@Test public void resolveMissing() { Result<CreditCurveDataKey> result = _fn.resolve(_env, _badSecurity); assertFalse(result.isSuccess()); }