DefaultDiscountingMulticurveBundleFn implements DiscountingMulticurveBundleFn { @Override public Result<MulticurveBundle> generateBundle( Environment env, CurveConstructionConfiguration curveConfig, Map<CurveConstructionConfiguration, Result<MulticurveBundle>> requiredCurves) { if (s_logger.isDebugEnabled()) { List<String> requiredCurveNames = new ArrayList<>(requiredCurves.size()); for (CurveConstructionConfiguration requiredCurveConfig : requiredCurves.keySet()) { requiredCurveNames.add(requiredCurveConfig.getName()); } s_logger.debug("Generating bundle '{}', requiredCurves {}, valuationTime {}", curveConfig.getName(), requiredCurveNames, env.getValuationTime()); } Result<FXMatrix> fxMatrixResult = _fxMatrixProvider.getFXMatrix(env, curveConfig); Result<MulticurveProviderDiscount> exogenousBundles = buildExogenousBundles(env, curveConfig, requiredCurves, fxMatrixResult); return getCurves(env, curveConfig, exogenousBundles, fxMatrixResult); } DefaultDiscountingMulticurveBundleFn(CurveDefinitionFn curveDefinitionProvider,
                                              CurveSpecificationFn curveSpecificationProvider,
                                              CurveSpecificationMarketDataFn curveSpecificationMarketDataProvider,
                                              FXMatrixFn fxMatrixProvider,
                                              HolidaySource holidaySource,
                                              CurveNodeConverterFn curveNodeConverter,
                                              RootFinderConfiguration rootFinderConfiguration,
                                              CurveNodeInstrumentDefinitionFactory curveNodeInstrumentDefinitionFactory,
                                              StringSet impliedCurveNames); @Override Result<MulticurveBundle> generateBundle(
      Environment env, CurveConstructionConfiguration curveConfig,
      Map<CurveConstructionConfiguration, Result<MulticurveBundle>> requiredCurves); @Override Result<ImpliedDepositCurveData> extractImpliedDepositCurveData(
      Environment env,
      CurveConstructionConfiguration curveConfig,
      Map<CurveConstructionConfiguration, Result<MulticurveBundle>> builtCurves);  }
@SuppressWarnings("unchecked") @Test public void generateBundle() { when(_fxmProvider.getFXMatrix(_env, _ccc)).thenReturn(Result.success(mock(FXMatrix.class))); when(_ccc.resolveCurveConfigurations()).thenReturn(Collections.singletonList(_cccExo)); when(_fxmProvider.getFXMatrix(_env, _cccExo)).thenReturn(Result.<FXMatrix> failure(new Exception())); CurveGroupConfiguration cgc = mock(CurveGroupConfiguration.class); when(_ccc.getCurveGroups()).thenReturn(Lists.newArrayList(cgc)); CurveDefinition cd = new CurveDefinition(IMPLIED_DEPO, Collections.<CurveNode> emptySet()); @SuppressWarnings("rawtypes") Map map = ImmutableMap.of(cd, Lists.newArrayList()); when(cgc.resolveTypesForCurves()).thenReturn(map); Result<MulticurveBundle> result = _fn.generateBundle(_env, _ccc, ImmutableMap.<CurveConstructionConfiguration, Result<MulticurveBundle>>of()); assertTrue("Expected failure", !result.isSuccess()); }