IndexNameMulticurveFilter implements MarketDataFilter, ImmutableBean { private Set<MulticurveMatchDetails> apply(MulticurveMetadata metadata) { String curveName = metadata.getCurveNamesByIndexName().get(_indexName); if (curveName != null) { return ImmutableSet.of(StandardMatchDetails.multicurve(curveName)); } else { return ImmutableSet.of(); } } @ImmutableConstructor  IndexNameMulticurveFilter(String indexName); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId, Object marketData); @Override Class<?> getMarketDataType(); @Override Class<MulticurveId> getMarketDataIdType(); static IndexNameMulticurveFilter.Meta meta(); static IndexNameMulticurveFilter.Builder builder(); @Override IndexNameMulticurveFilter.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); String getIndexName(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void bundle() { IndexNameMulticurveFilter gbpOnFilter = new IndexNameMulticurveFilter(MulticurveFilterTestUtils.GBP_OVERNIGHT_INDEX_NAME); Set<MulticurveMatchDetails> gbpOnMatches = gbpOnFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); Set<MulticurveMatchDetails> expectedGpbOnMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_OVERNIGHT)); assertEquals(expectedGpbOnMatches, gbpOnMatches); IndexNameMulticurveFilter eurLiborFilter = new IndexNameMulticurveFilter(MulticurveFilterTestUtils.EUR_LIBOR_6M_INDEX_NAME); Set<MulticurveMatchDetails> eurLiborMatches = eurLiborFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); Set<MulticurveMatchDetails> expectedEurLiborMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.EUR_LIBOR_6M)); assertEquals(expectedEurLiborMatches, eurLiborMatches); IndexNameMulticurveFilter nonMatchingFilter = new IndexNameMulticurveFilter("unknown index"); Set<MulticurveMatchDetails> nonMatchingMatches = nonMatchingFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); assertEquals(ImmutableSet.<MulticurveMatchDetails>of(), nonMatchingMatches); }
@Test public void config() { MulticurveFilterTestUtils.initializeServiceContext(); MulticurveId multicurveId = MulticurveId.of(MulticurveFilterTestUtils.CURVE_CONFIG_NAME); IndexNameMulticurveFilter gbpOnFilter = new IndexNameMulticurveFilter(MulticurveFilterTestUtils.GBP_OVERNIGHT_INDEX_NAME); Set<MulticurveMatchDetails> gbpOnMatches = gbpOnFilter.apply(multicurveId); Set<MulticurveMatchDetails> expectedGpbOnMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_OVERNIGHT)); assertEquals(expectedGpbOnMatches, gbpOnMatches); IndexNameMulticurveFilter eurLiborFilter = new IndexNameMulticurveFilter(MulticurveFilterTestUtils.EUR_LIBOR_6M_INDEX_NAME); Set<MulticurveMatchDetails> eurLiborMatches = eurLiborFilter.apply(multicurveId); Set<MulticurveMatchDetails> expectedEurLiborMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.EUR_LIBOR_6M)); assertEquals(expectedEurLiborMatches, eurLiborMatches); IndexNameMulticurveFilter nonMatchingFilter = new IndexNameMulticurveFilter("unknown index"); Set<MulticurveMatchDetails> nonMatchingMatches = nonMatchingFilter.apply(multicurveId); assertEquals(ImmutableSet.<MulticurveMatchDetails>of(), nonMatchingMatches); }