Source:
private void assertBuilder(ExampleMarketDataBuilder builder) { MarketEnvironment snapshot = builder.buildSnapshot(MARKET_DATA_DATE); assertEquals(MARKET_DATA_DATE, snapshot.getValuationDate().getSingleValue()); for (ObservableId id : TIME_SERIES) { assertFalse(snapshot.getTimeSeries(id).isEmpty(), "Time-series not found: " + id); } assertEquals(snapshot.getTimeSeries().size(), TIME_SERIES.size(), Messages.format("Snapshot contained unexpected time-series: {}", Sets.difference(snapshot.getTimeSeries().keySet(), TIME_SERIES))); for (MarketDataId<?> id : VALUES) { assertTrue(snapshot.findValue(id).isPresent(), "Id not found: " + id); } MarketDataBox<CurveGroup> curveGroupBox = snapshot.getValue(CurveGroupId.of(DEFAULT_CURVE_GROUP)); assertTrue(curveGroupBox.isSingleValue()); CurveGroup curveGroup = curveGroupBox.getSingleValue(); assertTrue(curveGroup.findDiscountCurve(Currency.USD).isPresent()); assertTrue(curveGroup.findDiscountCurve(Currency.GBP).isPresent()); assertTrue(curveGroup.findForwardCurve(IborIndices.USD_LIBOR_3M).isPresent()); assertTrue(curveGroup.findForwardCurve(IborIndices.GBP_LIBOR_3M).isPresent()); assertTrue(curveGroup.findForwardCurve(IborIndices.USD_LIBOR_6M).isPresent()); assertTrue(curveGroup.findForwardCurve(OvernightIndices.USD_FED_FUND).isPresent()); assertEquals(snapshot.getValues().size(), VALUES.size(), Messages.format("Snapshot contained unexpected market data: {}", Sets.difference(snapshot.getValues().keySet(), VALUES))); MarketDataRules expectedRules = MarketDataRules.anyTarget( MarketDataMappingsBuilder.create() .curveGroup(CurveGroupName.of("Default")) .build()); assertEquals(builder.rules(), expectedRules); }

Target:
private void assertBuilder(ExampleMarketDataBuilder builder) { MarketEnvironment snapshot = builder.buildSnapshot(MARKET_DATA_DATE); assertEquals(MARKET_DATA_DATE, snapshot.getValuationDate().getSingleValue()); for (ObservableId id : TIME_SERIES) { assertFalse(snapshot.getTimeSeries(id).isEmpty(), "Time-series not found: " + id); } assertEquals(snapshot.getTimeSeries().size(), TIME_SERIES.size(), Messages.format("Snapshot contained unexpected time-series: {}", Sets.difference(snapshot.getTimeSeries().keySet(), TIME_SERIES))); for (MarketDataId<?> id : VALUES) { assertTrue(snapshot.containsValue(id), "Id not found: " + id); } MarketDataBox<CurveGroup> curveGroupBox = snapshot.getValue(CurveGroupId.of(DEFAULT_CURVE_GROUP)); assertTrue(curveGroupBox.isSingleValue()); CurveGroup curveGroup = curveGroupBox.getSingleValue(); assertTrue(curveGroup.findDiscountCurve(Currency.USD).isPresent()); assertTrue(curveGroup.findDiscountCurve(Currency.GBP).isPresent()); assertTrue(curveGroup.findForwardCurve(IborIndices.USD_LIBOR_3M).isPresent()); assertTrue(curveGroup.findForwardCurve(IborIndices.GBP_LIBOR_3M).isPresent()); assertTrue(curveGroup.findForwardCurve(IborIndices.USD_LIBOR_6M).isPresent()); assertTrue(curveGroup.findForwardCurve(OvernightIndices.USD_FED_FUND).isPresent()); assertEquals(snapshot.getValues().size(), VALUES.size(), Messages.format("Snapshot contained unexpected market data: {}", Sets.difference(snapshot.getValues().keySet(), VALUES))); MarketDataRules expectedRules = MarketDataRules.anyTarget( MarketDataMappingsBuilder.create() .curveGroup(CurveGroupName.of("Default")) .build()); assertEquals(builder.rules(), expectedRules); }