StandAloneScenarioScript extends Script { Simulation getSimulation() { return _simulation; } StandAloneScenarioScript(); void view(Closure<?> body); void shockGrid(Closure<?> body); void shockList(Closure<?> body); void scenarios(Closure<?> body);  }
@Test public void scenarioList() { String scriptText = "shockList {\n" + " foo = [1, 2]\n" + " bar = ['a', 'b']\n" + " valTime = ['2014-01-14 12:03', '2014-02-14 12:03']\n" + "}\n" + "scenarios {\n" + " valuationTime valTime\n" + " marketData {\n" + " id 'SCHEME', bar\n" + " apply {\n" + " shift Absolute, foo\n" + " }\n" + " }\n" + "}"; StandAloneScenarioScript script = createScript(scriptText); Simulation simulation = script.getSimulation(); Map<String, Scenario> scenarios = simulation.getScenarios(); assertEquals(2, scenarios.size()); checkScenario(scenarios, "a", 1, "2014-01-14 12:03"); checkScenario(scenarios, "b", 2, "2014-02-14 12:03"); }
@Test public void scenarioGrid() { String scriptText = "shockGrid {\n" + " foo = [1, 2]\n" + " bar = ['a', 'b']\n" + "}\n" + "scenarios {\n" + " marketData {\n" + " id 'SCHEME', bar\n" + " apply {\n" + " shift Absolute, foo\n" + " }\n" + " }\n" + "}"; StandAloneScenarioScript script = createScript(scriptText); Simulation simulation = script.getSimulation(); Map<String, Scenario> scenarios = simulation.getScenarios(); assertEquals(4, scenarios.size()); checkScenario(scenarios, "a", 1, null); checkScenario(scenarios, "a", 2, null); checkScenario(scenarios, "b", 1, null); checkScenario(scenarios, "b", 2, null); }