//------------------------------------------------------------------------- public virtual void test_of_map() { ImmutableMap <Currency, CurveId> discounts = ImmutableMap.of(USD, CURVE_ID_DSC); ImmutableMap <Index, CurveId> forwards = ImmutableMap.of(USD_LIBOR_3M, CURVE_ID_FWD); RatesMarketDataLookup test = RatesMarketDataLookup.of(discounts, forwards); assertEquals(test.queryType(), typeof(RatesMarketDataLookup)); assertEquals(test.DiscountCurrencies, ImmutableSet.of(USD)); assertEquals(test.getDiscountMarketDataIds(USD), ImmutableSet.of(CURVE_ID_DSC)); assertEquals(test.ForwardIndices, ImmutableSet.of(USD_LIBOR_3M)); assertEquals(test.getForwardMarketDataIds(USD_LIBOR_3M), ImmutableSet.of(CURVE_ID_FWD)); assertThrowsIllegalArg(() => test.getDiscountMarketDataIds(GBP)); assertThrowsIllegalArg(() => test.getForwardMarketDataIds(GBP_LIBOR_3M)); assertEquals(test.ObservableSource, ObservableSource.NONE); assertEquals(test.FxRateLookup, FxRateLookup.ofRates()); assertEquals(test.requirements(USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_DSC).outputCurrencies(USD).build()); assertEquals(test.requirements(USD, USD_LIBOR_3M), FunctionRequirements.builder().valueRequirements(CURVE_ID_DSC, CURVE_ID_FWD).timeSeriesRequirements(IndexQuoteId.of(USD_LIBOR_3M)).outputCurrencies(USD).build()); assertEquals(test.requirements(ImmutableSet.of(USD), ImmutableSet.of(USD_LIBOR_3M)), FunctionRequirements.builder().valueRequirements(CURVE_ID_DSC, CURVE_ID_FWD).timeSeriesRequirements(IndexQuoteId.of(USD_LIBOR_3M)).outputCurrencies(USD).build()); assertThrowsIllegalArg(() => test.requirements(ImmutableSet.of(USD), ImmutableSet.of(GBP_LIBOR_3M))); assertEquals(test.ratesProvider(MOCK_MARKET_DATA), DefaultLookupRatesProvider.of((DefaultRatesMarketDataLookup)test, MOCK_MARKET_DATA)); }
//------------------------------------------------------------------------- public virtual void coverage() { ImmutableMap <Currency, CurveId> discounts = ImmutableMap.of(USD, CURVE_ID_DSC); ImmutableMap <Index, CurveId> forwards = ImmutableMap.of(USD_LIBOR_3M, CURVE_ID_FWD); DefaultRatesMarketDataLookup test = DefaultRatesMarketDataLookup.of(discounts, forwards, ObservableSource.NONE, FxRateLookup.ofRates()); coverImmutableBean(test); ImmutableMap <Currency, CurveId> discounts2 = ImmutableMap.of(GBP, CURVE_ID_DSC); ImmutableMap <Index, CurveId> forwards2 = ImmutableMap.of(GBP_LIBOR_3M, CURVE_ID_FWD); DefaultRatesMarketDataLookup test2 = DefaultRatesMarketDataLookup.of(discounts2, forwards2, OBS_SOURCE, FxRateLookup.ofRates(EUR)); coverBeanEquals(test, test2); // related coverage coverImmutableBean((ImmutableBean)test.marketDataView(MOCK_CALC_MARKET_DATA)); DefaultRatesScenarioMarketData.meta(); coverImmutableBean((ImmutableBean)test.marketDataView(MOCK_MARKET_DATA)); DefaultRatesMarketData.meta(); coverImmutableBean((ImmutableBean)test.marketDataView(MOCK_MARKET_DATA).ratesProvider()); DefaultLookupRatesProvider.meta(); }
//------------------------------------------------------------------------- public RatesProvider ratesProvider(MarketData marketData) { return(DefaultLookupRatesProvider.of(this, marketData)); }