CurveNameMulticurveFilter implements MarketDataFilter, ImmutableBean { @Override public Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId) { MulticurveId id = (MulticurveId) marketDataId; MulticurveMetadata metadata = MulticurveMetadata.forConfiguration(id.resolveConfig()); return apply(metadata); } @ImmutableConstructor  CurveNameMulticurveFilter(String curveName); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId, Object marketData); @Override Class<?> getMarketDataType(); @Override Class<MulticurveId> getMarketDataIdType(); static CurveNameMulticurveFilter.Meta meta(); static CurveNameMulticurveFilter.Builder builder(); @Override CurveNameMulticurveFilter.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); String getCurveName(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void bundle() { CurveNameMulticurveFilter usdDiscountingFilter = new CurveNameMulticurveFilter(MulticurveFilterTestUtils.USD_DISCOUNTING); Set<MulticurveMatchDetails> usdDiscountingMatches = usdDiscountingFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); Set<MulticurveMatchDetails> expectedUsdDiscountingMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_DISCOUNTING)); assertEquals(expectedUsdDiscountingMatches, usdDiscountingMatches); CurveNameMulticurveFilter eurLiborFilter = new CurveNameMulticurveFilter(MulticurveFilterTestUtils.EUR_LIBOR_6M); 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); CurveNameMulticurveFilter nonMatchingFilter = new CurveNameMulticurveFilter("unknown curve name"); 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); CurveNameMulticurveFilter usdDiscountingFilter = new CurveNameMulticurveFilter(MulticurveFilterTestUtils.USD_DISCOUNTING); Set<MulticurveMatchDetails> usdDiscountingMatches = usdDiscountingFilter.apply(multicurveId); Set<MulticurveMatchDetails> expectedUsdDiscountingMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_DISCOUNTING)); assertEquals(expectedUsdDiscountingMatches, usdDiscountingMatches); CurveNameMulticurveFilter eurLiborFilter = new CurveNameMulticurveFilter(MulticurveFilterTestUtils.EUR_LIBOR_6M); Set<MulticurveMatchDetails> eurLiborMatches = eurLiborFilter.apply(multicurveId); Set<MulticurveMatchDetails> expectedEurLiborMatches = ImmutableSet.of(StandardMatchDetails.multicurve(MulticurveFilterTestUtils.EUR_LIBOR_6M)); assertEquals(expectedEurLiborMatches, eurLiborMatches); CurveNameMulticurveFilter nonMatchingFilter = new CurveNameMulticurveFilter("unknown curve name"); Set<MulticurveMatchDetails> nonMatchingMatches = nonMatchingFilter.apply(multicurveId); assertEquals(ImmutableSet.<MulticurveMatchDetails>of(), nonMatchingMatches); }