@Test void createGroups_withTwoRelatedFields_givesOneGroupOfSizeOne() { Field first = createField("first"); Field second = createField("second"); Fields fields = new ProfileFields(Arrays.asList(first, second)); Map<Field, FieldSpec> fieldSpecMap = fieldSpecMapOf(first, second); 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(1, groups.size()); }
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()); }
RowSpecGrouper { 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()); } }
RowSpecGrouper { 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()); }  }
RowSpecGrouper { 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()); }  static Set<FieldSpecGroup> createGroups(RowSpec rowSpec); }
RowSpecGrouper { 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()); }  static Set<FieldSpecGroup> createGroups(RowSpec rowSpec);  }