test_class.file: core/src/test/java/com/scottlogic/datahelix/generator/core/generation/grouped/FieldSpecGroupValueGeneratorTest.java
test_class.identifier: FieldSpecGroupValueGeneratorTest
test_case.body: @Test
      public void generate_withGroupOfSingleField_returnsCorrectStream() {
          Map<Field, FieldSpec> specMap = new HashMap<>();
          Field firstField = createField("first");
          FieldSpec firstSpec = FieldSpecFactory.fromType(firstField.getType());
          specMap.put(firstField, FieldSpecFactory.fromType(firstField.getType()));
  
          FieldSpecValueGenerator underlyingGenerator = mock(FieldSpecValueGenerator.class);
          String result = "result";
          DataBagValue firstValue = new DataBagValue(result);
          when(underlyingGenerator.generate(any(Field.class), eq(firstSpec))).thenReturn(Stream.of(firstValue));
  
          FieldSpecGroupValueGenerator generator = new FieldSpecGroupValueGenerator(underlyingGenerator, CombinationStrategyType.MINIMAL);
  
          FieldSpecGroup group = new FieldSpecGroup(specMap, Collections.emptyList());
  
          Stream<DataBag> stream = generator.generate(group);
  
          Map<Field, DataBagValue> dataBag = new HashMap<>();
          dataBag.put(firstField, firstValue);
          assertEquals(Collections.singleton(new DataBag(dataBag)), stream.collect(Collectors.toSet()));
      }
test_case.class_method_signature: FieldSpecGroupValueGeneratorTest.generate_withGroupOfSingleField_returnsCorrectStream()
test_case.full_signature: @Test public void generate_withGroupOfSingleField_returnsCorrectStream()
test_case.identifier: generate_withGroupOfSingleField_returnsCorrectStream
test_case.invocations: createField fromType getType put fromType getType mock thenReturn when generate any eq of emptyList generate put assertEquals singleton collect toSet
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void generate_withGroupOfSingleField_returnsCorrectStream()
focal_class.declarator: combinationStrategy
focal_class.modifier: private final
focal_class.original_string: private final CombinationStrategyType combinationStrategy;
focal_class.type: CombinationStrategyType
focal_class.var_name: combinationStrategy
focal_class.declarator: underlyingGenerator
focal_class.modifier: private final
focal_class.original_string: private final FieldSpecValueGenerator underlyingGenerator;
focal_class.type: FieldSpecValueGenerator
focal_class.var_name: underlyingGenerator
focal_class.declarator: fieldSpecMerger = new FieldSpecMerger()
focal_class.modifier: private final
focal_class.original_string: private final FieldSpecMerger fieldSpecMerger = new FieldSpecMerger();
focal_class.type: FieldSpecMerger
focal_class.var_name: fieldSpecMerger
focal_class.file: core/src/main/java/com/scottlogic/datahelix/generator/core/generation/grouped/FieldSpecGroupValueGenerator.java
focal_class.identifier: FieldSpecGroupValueGenerator
focal_class.class_method_signature: FieldSpecGroupValueGenerator.FieldSpecGroupValueGenerator(FieldSpecValueGenerator underlyingGenerator, CombinationStrategyType combinationStrategy)
focal_class.full_signature: @Inject public  FieldSpecGroupValueGenerator(FieldSpecValueGenerator underlyingGenerator, CombinationStrategyType combinationStrategy)
focal_class.identifier: FieldSpecGroupValueGenerator
focal_class.modifiers: @Inject public
focal_class.parameters: (FieldSpecValueGenerator underlyingGenerator, CombinationStrategyType combinationStrategy)
focal_class.signature:  FieldSpecGroupValueGenerator(FieldSpecValueGenerator underlyingGenerator, CombinationStrategyType combinationStrategy)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.generate(FieldSpecGroup group)
focal_class.full_signature: public Stream<DataBag> generate(FieldSpecGroup group)
focal_class.identifier: generate
focal_class.modifiers: public
focal_class.parameters: (FieldSpecGroup group)
focal_class.return: Stream<DataBag>
focal_class.signature: Stream<DataBag> generate(FieldSpecGroup group)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.getFirst(FieldSpecGroup keySet)
focal_class.full_signature: private Field getFirst(FieldSpecGroup keySet)
focal_class.identifier: getFirst
focal_class.modifiers: private
focal_class.parameters: (FieldSpecGroup keySet)
focal_class.return: Field
focal_class.signature: Field getFirst(FieldSpecGroup keySet)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.updateFirstSpecFromRelations(Field first, FieldSpecGroup group)
focal_class.full_signature: private FieldSpec updateFirstSpecFromRelations(Field first, FieldSpecGroup group)
focal_class.identifier: updateFirstSpecFromRelations
focal_class.modifiers: private
focal_class.parameters: (Field first, FieldSpecGroup group)
focal_class.return: FieldSpec
focal_class.signature: FieldSpec updateFirstSpecFromRelations(Field first, FieldSpecGroup group)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.mergeOptionalFieldspecs(Optional<FieldSpec> left, Optional<FieldSpec> right)
focal_class.full_signature: private Optional<FieldSpec> mergeOptionalFieldspecs(Optional<FieldSpec> left, Optional<FieldSpec> right)
focal_class.identifier: mergeOptionalFieldspecs
focal_class.modifiers: private
focal_class.parameters: (Optional<FieldSpec> left, Optional<FieldSpec> right)
focal_class.return: Optional<FieldSpec>
focal_class.signature: Optional<FieldSpec> mergeOptionalFieldspecs(Optional<FieldSpec> left, Optional<FieldSpec> right)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.isRelatedToField(Field field, FieldSpecRelation relation)
focal_class.full_signature: private boolean isRelatedToField(Field field, FieldSpecRelation relation)
focal_class.identifier: isRelatedToField
focal_class.modifiers: private
focal_class.parameters: (Field field, FieldSpecRelation relation)
focal_class.return: boolean
focal_class.signature: boolean isRelatedToField(Field field, FieldSpecRelation relation)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.createModifierForField(Field first,
                                               FieldSpecRelation relation,
                                               FieldSpecGroup group)
focal_class.full_signature: private FieldSpec createModifierForField(Field first,
                                               FieldSpecRelation relation,
                                               FieldSpecGroup group)
focal_class.identifier: createModifierForField
focal_class.modifiers: private
focal_class.parameters: (Field first,
                                               FieldSpecRelation relation,
                                               FieldSpecGroup group)
focal_class.return: FieldSpec
focal_class.signature: FieldSpec createModifierForField(Field first,
                                               FieldSpecRelation relation,
                                               FieldSpecGroup group)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.generateRemainingData(Field generatedField, DataBag dataBag, FieldSpecGroup group)
focal_class.full_signature: private Stream<DataBag> generateRemainingData(Field generatedField, DataBag dataBag, FieldSpecGroup group)
focal_class.identifier: generateRemainingData
focal_class.modifiers: private
focal_class.parameters: (Field generatedField, DataBag dataBag, FieldSpecGroup group)
focal_class.return: Stream<DataBag>
focal_class.signature: Stream<DataBag> generateRemainingData(Field generatedField, DataBag dataBag, FieldSpecGroup group)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.updateRelatedFieldSpecs(Field generatedField, DataBagValue generatedValue, FieldSpecGroup group)
focal_class.full_signature: private FieldSpecGroup updateRelatedFieldSpecs(Field generatedField, DataBagValue generatedValue, FieldSpecGroup group)
focal_class.identifier: updateRelatedFieldSpecs
focal_class.modifiers: private
focal_class.parameters: (Field generatedField, DataBagValue generatedValue, FieldSpecGroup group)
focal_class.return: FieldSpecGroup
focal_class.signature: FieldSpecGroup updateRelatedFieldSpecs(Field generatedField, DataBagValue generatedValue, FieldSpecGroup group)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.applyGranularitiesToFieldSpecs(Map<Field, FieldSpec> original, Map<Field, FieldSpec> withoutGranularities)
focal_class.full_signature: private Map<Field, FieldSpec> applyGranularitiesToFieldSpecs(Map<Field, FieldSpec> original, Map<Field, FieldSpec> withoutGranularities)
focal_class.identifier: applyGranularitiesToFieldSpecs
focal_class.modifiers: private
focal_class.parameters: (Map<Field, FieldSpec> original, Map<Field, FieldSpec> withoutGranularities)
focal_class.return: Map<Field, FieldSpec>
focal_class.signature: Map<Field, FieldSpec> applyGranularitiesToFieldSpecs(Map<Field, FieldSpec> original, Map<Field, FieldSpec> withoutGranularities)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.applyGranularityToFieldSpec(FieldSpec original, FieldSpec withoutGranularity)
focal_class.full_signature: private FieldSpec applyGranularityToFieldSpec(FieldSpec original, FieldSpec withoutGranularity)
focal_class.identifier: applyGranularityToFieldSpec
focal_class.modifiers: private
focal_class.parameters: (FieldSpec original, FieldSpec withoutGranularity)
focal_class.return: FieldSpec
focal_class.signature: FieldSpec applyGranularityToFieldSpec(FieldSpec original, FieldSpec withoutGranularity)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.updateSpec(Field field, FieldSpec previous, Map<Field, FieldSpec> fieldUpdates)
focal_class.full_signature: private FieldSpec updateSpec(Field field, FieldSpec previous, Map<Field, FieldSpec> fieldUpdates)
focal_class.identifier: updateSpec
focal_class.modifiers: private
focal_class.parameters: (Field field, FieldSpec previous, Map<Field, FieldSpec> fieldUpdates)
focal_class.return: FieldSpec
focal_class.signature: FieldSpec updateSpec(Field field, FieldSpec previous, Map<Field, FieldSpec> fieldUpdates)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.applyCombinationStrategy(Stream<DataBag> dataBagStream)
focal_class.full_signature: private Stream<DataBag> applyCombinationStrategy(Stream<DataBag> dataBagStream)
focal_class.identifier: applyCombinationStrategy
focal_class.modifiers: private
focal_class.parameters: (Stream<DataBag> dataBagStream)
focal_class.return: Stream<DataBag>
focal_class.signature: Stream<DataBag> applyCombinationStrategy(Stream<DataBag> dataBagStream)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.toDataBag(Field field, DataBagValue value)
focal_class.full_signature: private DataBag toDataBag(Field field, DataBagValue value)
focal_class.identifier: toDataBag
focal_class.modifiers: private
focal_class.parameters: (Field field, DataBagValue value)
focal_class.return: DataBag
focal_class.signature: DataBag toDataBag(Field field, DataBagValue value)
focal_class.class_method_signature: FieldSpecGroupValueGenerator.removeSpecFromGroup(Field first, FieldSpecGroup group)
focal_class.full_signature: private FieldSpecGroup removeSpecFromGroup(Field first, FieldSpecGroup group)
focal_class.identifier: removeSpecFromGroup
focal_class.modifiers: private
focal_class.parameters: (Field first, FieldSpecGroup group)
focal_class.return: FieldSpecGroup
focal_class.signature: FieldSpecGroup removeSpecFromGroup(Field first, FieldSpecGroup group)
focal_method.body: public Stream<DataBag> generate(FieldSpecGroup group) {
          Field first = getFirst(group);
  
          if (group.fieldSpecs().size() == 1) {
              return underlyingGenerator.generate(first, group.fieldSpecs().get(first))
                  .map(val -> toDataBag(first, val));
          }
  
          FieldSpec firstSpec = updateFirstSpecFromRelations(first, group);
  
          Stream<DataBag> firstDataBagValues = underlyingGenerator.generate(first, firstSpec)
              .map(value -> toDataBag(first, value));
  
          return flatMap(
              firstDataBagValues,
              dataBag -> generateRemainingData(first, dataBag, removeSpecFromGroup(first, group)));
      }
focal_method.class_method_signature: FieldSpecGroupValueGenerator.generate(FieldSpecGroup group)
focal_method.full_signature: public Stream<DataBag> generate(FieldSpecGroup group)
focal_method.identifier: generate
focal_method.invocations: getFirst size fieldSpecs map generate get fieldSpecs toDataBag updateFirstSpecFromRelations map generate toDataBag flatMap generateRemainingData removeSpecFromGroup
focal_method.modifiers: public
focal_method.parameters: (FieldSpecGroup group)
focal_method.return: Stream<DataBag>
focal_method.signature: Stream<DataBag> generate(FieldSpecGroup group)