public virtual void merge_content_2() { ImmutableRatesProvider test1 = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(GBP, DISCOUNT_CURVE_GBP).timeSeries(GBP_USD_WM, TS).build(); ImmutableRatesProvider test2 = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(USD, DISCOUNT_CURVE_USD).iborIndexCurve(USD_LIBOR_3M, USD_LIBOR_CURVE).overnightIndexCurve(USD_FED_FUND, FED_FUND_CURVE).priceIndexCurve(GB_RPI, GBPRI_CURVE).timeSeries(GB_RPI, TS).build(); ImmutableRatesProvider merged = ImmutableRatesProvider.combined(FX_MATRIX, test1, test2); assertEquals(merged.ValuationDate, VAL_DATE); assertEquals(merged.discountFactors(USD), DiscountFactors.of(USD, VAL_DATE, DISCOUNT_CURVE_USD)); assertEquals(merged.discountFactors(GBP), DiscountFactors.of(GBP, VAL_DATE, DISCOUNT_CURVE_GBP)); assertEquals(merged.iborIndexRates(USD_LIBOR_3M), IborIndexRates.of(USD_LIBOR_3M, VAL_DATE, USD_LIBOR_CURVE)); assertEquals(merged.overnightIndexRates(USD_FED_FUND), OvernightIndexRates.of(USD_FED_FUND, VAL_DATE, FED_FUND_CURVE)); assertEquals(merged.priceIndexValues(GB_RPI), PriceIndexValues.of(GB_RPI, VAL_DATE, GBPRI_CURVE, TS)); assertEquals(merged.timeSeries(GBP_USD_WM), TS); assertEquals(merged.FxRateProvider, FX_MATRIX); }
//------------------------------------------------------------------------- public virtual void test_of_withoutFixings() { DiscountOvernightIndexRates test = DiscountOvernightIndexRates.of(GBP_SONIA, DFCURVE); assertEquals(test.Index, GBP_SONIA); assertEquals(test.ValuationDate, DATE_VAL); assertEquals(test.Fixings, SERIES_EMPTY); assertEquals(test.DiscountFactors, DFCURVE); assertEquals(test.ParameterCount, DFCURVE.ParameterCount); assertEquals(test.getParameter(0), DFCURVE.getParameter(0)); assertEquals(test.getParameterMetadata(0), DFCURVE.getParameterMetadata(0)); assertEquals(test.withParameter(0, 1d).DiscountFactors, DFCURVE.withParameter(0, 1d)); assertEquals(test.withPerturbation((i, v, m) => v + 1d).DiscountFactors, DFCURVE.withPerturbation((i, v, m) => v + 1d)); assertEquals(test.findData(CURVE.Name), CURVE); assertEquals(test.findData(CurveName.of("Rubbish")), null); // check IborIndexRates OvernightIndexRates test2 = OvernightIndexRates.of(GBP_SONIA, DATE_VAL, CURVE); assertEquals(test, test2); }