CurrencyMulticurveFilter implements MarketDataFilter, ImmutableBean { @Override public Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId) { MulticurveId id = (MulticurveId) marketDataId; MulticurveMetadata metadata = MulticurveMetadata.forConfiguration(id.resolveConfig()); return apply(metadata); } @ImmutableConstructor  CurrencyMulticurveFilter(Currency currency); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId, Object marketData); @Override Class<?> getMarketDataType(); @Override Class<MulticurveId> getMarketDataIdType(); static CurrencyMulticurveFilter.Meta meta(); static CurrencyMulticurveFilter.Builder builder(); @Override CurrencyMulticurveFilter.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); Currency getCurrency(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void bundle() { CurrencyMulticurveFilter usdFilter = new CurrencyMulticurveFilter(Currency.USD); Set<MulticurveMatchDetails> usdMatches = usdFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); ImmutableSet<MulticurveMatchDetails> expectedUsdMatches = ImmutableSet.of( StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_DISCOUNTING), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_LIBOR_3M), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_OVERNIGHT)); assertEquals(expectedUsdMatches, usdMatches); CurrencyMulticurveFilter gbpFilter = new CurrencyMulticurveFilter(Currency.GBP); Set<MulticurveMatchDetails> gbpMatches = gbpFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); ImmutableSet<MulticurveMatchDetails> expectedGbpMatches = ImmutableSet.of( StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_DISCOUNTING), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_OVERNIGHT)); assertEquals(expectedGbpMatches, gbpMatches); CurrencyMulticurveFilter eurFilter = new CurrencyMulticurveFilter(Currency.EUR); Set<MulticurveMatchDetails> eurMatches = eurFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); ImmutableSet<MulticurveMatchDetails> expectedEurMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.EUR_LIBOR_6M)); assertEquals(expectedEurMatches, eurMatches); CurrencyMulticurveFilter chfFilter = new CurrencyMulticurveFilter(Currency.CHF); Set<MulticurveMatchDetails> chfMatches = chfFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); assertEquals(ImmutableSet.<MulticurveMatchDetails>of(), chfMatches); }
@Test public void config() { MulticurveFilterTestUtils.initializeServiceContext(); MulticurveId multicurveId = MulticurveId.of(MulticurveFilterTestUtils.CURVE_CONFIG_NAME); CurrencyMulticurveFilter usdFilter = new CurrencyMulticurveFilter(Currency.USD); Set<MulticurveMatchDetails> usdMatches = usdFilter.apply(multicurveId); ImmutableSet<MulticurveMatchDetails> expectedUsdMatches = ImmutableSet.of( StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_DISCOUNTING), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_LIBOR_3M), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_OVERNIGHT)); assertEquals(expectedUsdMatches, usdMatches); CurrencyMulticurveFilter gbpFilter = new CurrencyMulticurveFilter(Currency.GBP); Set<MulticurveMatchDetails> gbpMatches = gbpFilter.apply(multicurveId); ImmutableSet<MulticurveMatchDetails> expectedGbpMatches = ImmutableSet.of( StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_DISCOUNTING), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_OVERNIGHT)); assertEquals(expectedGbpMatches, gbpMatches); CurrencyMulticurveFilter eurFilter = new CurrencyMulticurveFilter(Currency.EUR); Set<MulticurveMatchDetails> eurMatches = eurFilter.apply(multicurveId); ImmutableSet<MulticurveMatchDetails> expectedEurMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.EUR_LIBOR_6M)); assertEquals(expectedEurMatches, eurMatches); CurrencyMulticurveFilter chfFilter = new CurrencyMulticurveFilter(Currency.CHF); Set<MulticurveMatchDetails> chfMatches = chfFilter.apply(multicurveId); assertEquals(ImmutableSet.<MulticurveMatchDetails>of(), chfMatches); }