public void testCreateAndSaveScenarioWithOrders() {
Order order = givenStoredOrderInDefaultScenario();
int previous = scenarioModel.getScenarios().size();
Scenario defaultScenario = PredefinedScenarios.MASTER.getScenario();
scenarioModel.initCreateDerived(defaultScenario);
Scenario newScenario = scenarioModel.getScenario();
newScenario.setName("scenario-name-" + UUID.randomUUID());
scenarioModel.confirmSave();
assertThat(scenarioModel.getScenarios().size(), equalTo(previous + 1));
Scenario newScenarioSaved = scenarioModel.getScenarios().get(previous);
assertThat(newScenarioSaved.getId(), equalTo(newScenario.getId()));
assertThat(newScenarioSaved.getOrders().size(), equalTo(defaultScenario
.getOrders().size()));
assertNotNull(newScenarioSaved.getOrders().get(order));
assertThat(newScenarioSaved.getOrders().get(order).getOwnerScenario()
.getId(), equalTo(defaultScenario.getId()));
}