DefaultCreditKeyMapperFn implements CreditKeyMapperFn { @Override public Result<CreditCurveDataKey> getMapping(CreditCurveDataKey key) { Map<CreditCurveDataKey, CreditCurveDataKey> keyMap = _keyMap.getSecurityCurveMappings(); CreditCurveDataKey resultKey = keyMap.containsKey(key) ? keyMap.get(key) : key; return Result.success(resultKey); } DefaultCreditKeyMapperFn(CreditCurveDataKeyMap keyMap); @Override Result<CreditCurveDataKey> getMapping(CreditCurveDataKey key);  }
@Test public void successfulMap() { Result<CreditCurveDataKey> result = _fn.getMapping(_source); assertTrue("Expected success", result.isSuccess()); assertEquals("Expected target key", _target, result.getValue()); }
@Test public void noMapping() { Result<CreditCurveDataKey> result = _fn.getMapping(_missing); assertTrue("Expected success", result.isSuccess()); assertEquals("Expected same key (i.e. missing)", _missing, result.getValue()); }