ScenarioDataBuilder { public ScenarioDataBuilder addSecurityValue(String scenarioId, Security security, FieldName fieldName, double value) { builder(scenarioId).add(SecurityId.of(security, Double.class, fieldName), value); return this; }  ScenarioDataBuilder addMulticurve(String scenarioId, String name, MulticurveBundle multicurve); ScenarioDataBuilder addFxRate(String scenarioId, CurrencyPair currencyPair, double rate); ScenarioDataBuilder addSecurityMarketValue(String scenarioId, Security security, double marketValue); ScenarioDataBuilder addSecurityValue(String scenarioId, Security security, FieldName fieldName, double value); ScenarioDataBuilder addSecurityValue(String scenarioId, Security security, FieldName fieldName, Object value); ScenarioDataBuilder valuationTime(String scenarioId, ZonedDateTime valuationTime); ScenarioMarketDataEnvironment build();  }
@Test public void addSecurityValue() { Security security = new SimpleSecurity(UniqueId.parse("test~123"), ExternalId.parse("ex~123").toBundle(), "TEST", "test security"); ScenarioMarketDataEnvironment env = new ScenarioDataBuilder() .addSecurityValue("1", security, FieldName.of("foo"), 1d) .addSecurityValue("2", security, FieldName.of("bar"), 2d) .addSecurityValue("3", security, FieldName.of("baz"), LocalDate.of(2011, 3, 8)) .valuationTime("1", ZonedDateTime.now()) .valuationTime("2", ZonedDateTime.now()) .valuationTime("3", ZonedDateTime.now()) .build(); SingleValueRequirement req1 = SingleValueRequirement.of(SecurityId.of(security, Double.class, FieldName.of("foo"))); SingleValueRequirement req2 = SingleValueRequirement.of(SecurityId.of(security, Double.class, FieldName.of("bar"))); SingleValueRequirement req3 = SingleValueRequirement.of(SecurityId.of(security, LocalDate.class, FieldName.of("baz"))); assertEquals(1d, env.getData().get("1").getData().get(req1)); assertEquals(2d, env.getData().get("2").getData().get(req2)); assertEquals(LocalDate.of(2011, 3, 8), env.getData().get("3").getData().get(req3)); }