ScenarioDefinition implements ImmutableBean { public static ScenarioDefinition ofMappings(List<? extends PerturbationMapping<?>> mappings) { ArgumentChecker.notEmpty(mappings, "mappings"); int numScenarios = countScenarios(mappings, false); for (int i = 1; i < mappings.size(); i++) { if (mappings.get(i).getPerturbations().size() != numScenarios) { throw new IllegalArgumentException( "All mappings must have the same number of perturbations. First mapping" + " has " + numScenarios + " perturbations, mapping " + i + " has " + mappings.get(i).getPerturbations().size()); } } ImmutableSet<String> scenarioNames = generateNames(numScenarios); return new ScenarioDefinition(createScenarios(scenarioNames, mappings, false)); } private  ScenarioDefinition(
      List<SingleScenarioDefinition> scenarios); static ScenarioDefinition ofScenarios(List<SingleScenarioDefinition> scenarios); static ScenarioDefinition ofScenarios(SingleScenarioDefinition... scenarios); static ScenarioDefinition ofMappings(List<? extends PerturbationMapping<?>> mappings); static ScenarioDefinition ofMappings(
      ImmutableSet<String> scenarioNames,
      List<? extends PerturbationMapping<?>> mappings); static ScenarioDefinition ofAllCombinations(List<? extends PerturbationMapping<?>> mappings); static ScenarioDefinition ofAllCombinations(
      ImmutableSet<String> scenarioNames,
      List<? extends PerturbationMapping<?>> mappings); static ScenarioDefinition.Meta meta(); static ScenarioDefinition.Builder builder(); @Override ScenarioDefinition.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); ImmutableList<SingleScenarioDefinition> getScenarios(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofMappingsWrongNumberOfScenarioNames() { List<PerturbationMapping<TestPerturbation>> mappings = ImmutableList.of(MAPPING_A, MAPPING_B, MAPPING_C); ImmutableSet<String> scenarioNames = ImmutableSet.of("foo", "bar", "baz"); ScenarioDefinition.ofMappings(scenarioNames, mappings); }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofMappingsDifferentNumberOfPerturbations() { PerturbationMapping<TestPerturbation> mappingC = PerturbationMapping.of(FILTER_C, PERTURBATION_C1); List<PerturbationMapping<TestPerturbation>> mappings = ImmutableList.of(MAPPING_A, MAPPING_B, mappingC); ScenarioDefinition.ofMappings(mappings); }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofMappingsWithNamesDifferentNumberOfPerturbations() { PerturbationMapping<TestPerturbation> mappingC = PerturbationMapping.of(FILTER_C, PERTURBATION_C1); List<PerturbationMapping<TestPerturbation>> mappings = ImmutableList.of(MAPPING_A, MAPPING_B, mappingC); ImmutableSet<String> scenarioNames = ImmutableSet.of("foo", "bar"); ScenarioDefinition.ofMappings(scenarioNames, mappings); }