test_class.file: core/src/test/java/com/scottlogic/datahelix/generator/core/generation/grouped/RowSpecGrouperTest.java
test_class.identifier: RowSpecGrouperTest
test_case.body: @Test
      void createGroups_withTwoAndOneFields_givesTwoGroups() {
          Field first = createField("first");
          Field second = createField("second");
          Field third = createField("third");
          Fields fields = new ProfileFields(Arrays.asList(first, second, third));
  
          Map<Field, FieldSpec> fieldSpecMap = fieldSpecMapOf(first, second, third);
  
          FieldSpecRelation relation = link(first, second);
          List<FieldSpecRelation> relations = Collections.singletonList(relation);
  
          RowSpec spec = new RowSpec(fields, fieldSpecMap, relations);
  
          Set<FieldSpecGroup> groups = RowSpecGrouper.createGroups(spec);
  
          assertEquals(2, groups.size());
      }
test_case.class_method_signature: RowSpecGrouperTest.createGroups_withTwoAndOneFields_givesTwoGroups()
test_case.full_signature: @Test void createGroups_withTwoAndOneFields_givesTwoGroups()
test_case.identifier: createGroups_withTwoAndOneFields_givesTwoGroups
test_case.invocations: createField createField createField asList fieldSpecMapOf link singletonList createGroups assertEquals size
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void createGroups_withTwoAndOneFields_givesTwoGroups()
focal_class.file: core/src/main/java/com/scottlogic/datahelix/generator/core/generation/grouped/RowSpecGrouper.java
focal_class.identifier: RowSpecGrouper
focal_class.class_method_signature: RowSpecGrouper.createGroups(RowSpec rowSpec)
focal_class.full_signature: public static Set<FieldSpecGroup> createGroups(RowSpec rowSpec)
focal_class.identifier: createGroups
focal_class.modifiers: public static
focal_class.parameters: (RowSpec rowSpec)
focal_class.return: Set<FieldSpecGroup>
focal_class.signature: Set<FieldSpecGroup> createGroups(RowSpec rowSpec)
focal_class.class_method_signature: RowSpecGrouper.findGroups(List<Field> fields, List<FieldPair> pairs)
focal_class.full_signature: private static Set<FieldGroup> findGroups(List<Field> fields, List<FieldPair> pairs)
focal_class.identifier: findGroups
focal_class.modifiers: private static
focal_class.parameters: (List<Field> fields, List<FieldPair> pairs)
focal_class.return: Set<FieldGroup>
focal_class.signature: Set<FieldGroup> findGroups(List<Field> fields, List<FieldPair> pairs)
focal_class.class_method_signature: RowSpecGrouper.findGroupsFromMap(Map<Field, List<Field>> map)
focal_class.full_signature: private static Set<FieldGroup> findGroupsFromMap(Map<Field, List<Field>> map)
focal_class.identifier: findGroupsFromMap
focal_class.modifiers: private static
focal_class.parameters: (Map<Field, List<Field>> map)
focal_class.return: Set<FieldGroup>
focal_class.signature: Set<FieldGroup> findGroupsFromMap(Map<Field, List<Field>> map)
focal_class.class_method_signature: RowSpecGrouper.findGroup(Field initial, Map<Field, List<Field>> map)
focal_class.full_signature: private static Set<Field> findGroup(Field initial, Map<Field, List<Field>> map)
focal_class.identifier: findGroup
focal_class.modifiers: private static
focal_class.parameters: (Field initial, Map<Field, List<Field>> map)
focal_class.return: Set<Field>
focal_class.signature: Set<Field> findGroup(Field initial, Map<Field, List<Field>> map)
focal_class.class_method_signature: RowSpecGrouper.findGroupRecursive(Deque<Field> fieldsToSearch,
                                                   Set<Field> found,
                                                   Map<Field, List<Field>> map)
focal_class.full_signature: private static Set<Field> findGroupRecursive(Deque<Field> fieldsToSearch,
                                                   Set<Field> found,
                                                   Map<Field, List<Field>> map)
focal_class.identifier: findGroupRecursive
focal_class.modifiers: private static
focal_class.parameters: (Deque<Field> fieldsToSearch,
                                                   Set<Field> found,
                                                   Map<Field, List<Field>> map)
focal_class.return: Set<Field>
focal_class.signature: Set<Field> findGroupRecursive(Deque<Field> fieldsToSearch,
                                                   Set<Field> found,
                                                   Map<Field, List<Field>> map)
focal_class.class_method_signature: RowSpecGrouper.createFieldSpecGroups(List<Field> fields, RowSpec rowSpec)
focal_class.full_signature: private static FieldSpecGroup createFieldSpecGroups(List<Field> fields, RowSpec rowSpec)
focal_class.identifier: createFieldSpecGroups
focal_class.modifiers: private static
focal_class.parameters: (List<Field> fields, RowSpec rowSpec)
focal_class.return: FieldSpecGroup
focal_class.signature: FieldSpecGroup createFieldSpecGroups(List<Field> fields, RowSpec rowSpec)
focal_class.class_method_signature: RowSpecGrouper.addToBoth(T element, Collection<T> first, Collection<T> second)
focal_class.full_signature: private static void addToBoth(T element, Collection<T> first, Collection<T> second)
focal_class.identifier: addToBoth
focal_class.modifiers: private static
focal_class.parameters: (T element, Collection<T> first, Collection<T> second)
focal_class.return: void
focal_class.signature: void addToBoth(T element, Collection<T> first, Collection<T> second)
focal_method.body: public static Set<FieldSpecGroup> createGroups(RowSpec rowSpec) {
          List<FieldPair> pairs = rowSpec.getRelations().stream()
              .map(relation -> new FieldPair(relation.main(), relation.other()))
              .collect(Collectors.toList());
  
          return findGroups(rowSpec.getFields().asList(), pairs)
              .stream().map(fs->createFieldSpecGroups(fs.fields(), rowSpec))
              .collect(Collectors.toSet());
      }
focal_method.class_method_signature: RowSpecGrouper.createGroups(RowSpec rowSpec)
focal_method.full_signature: public static Set<FieldSpecGroup> createGroups(RowSpec rowSpec)
focal_method.identifier: createGroups
focal_method.invocations: collect map stream getRelations main other toList collect map stream findGroups asList getFields createFieldSpecGroups fields toSet
focal_method.modifiers: public static
focal_method.parameters: (RowSpec rowSpec)
focal_method.return: Set<FieldSpecGroup>
focal_method.signature: Set<FieldSpecGroup> createGroups(RowSpec rowSpec)