@Test public void testAggregateNoDocumentation() { final StructureField structureField = new StructureField("structureField", 1, DataType.DQ8); final Structure structure = new Structure("structure-nodoc", Collections.singletonList(structureField)); final List<RecordStructure> aggregates = aggregator.aggregate(Collections.singletonList(structure), Collections.<String, RecordStructureDocumentation> emptyMap()); assertThat(aggregates).hasSize(1); final RecordStructure aggregate = aggregates.get(0); assertThat(aggregate.getName()).isEqualTo(structure.getName()); assertThat(aggregate.getDescription()).isEmpty(); assertThat(aggregate.getStructureType()).isNull(); assertThat(aggregate.getRootLevelMemberCount()).isEqualTo(1); final RecordStructureField aggregateField = aggregate.getRootLevelMember(0); assertThat(aggregateField.getName()).isEqualTo(structureField.getName()); assertThat(aggregateField.getDataType()).isEqualTo(structureField.getDataType()); assertThat(aggregateField.getDescription()).isEmpty(); assertThat(aggregateField.getCodeSets()).isEmpty(); assertThat(aggregateField.getValues()).isEmpty(); assertThat(aggregateField.isOptional()).isFalse(); }
public List<RecordStructure> aggregate(final List<Structure> structures, final Map<String, RecordStructureDocumentation> recordStructureDocumentation) { if (structures == null) { throw new IllegalArgumentException("Structures cannot be null."); } if (recordStructureDocumentation == null) { throw new IllegalArgumentException("Record structure documentation cannot be null."); } final List<RecordStructure> records = new ArrayList<RecordStructure>(structures.size()); for (final Structure structure : structures) { final String structureName = structure.getName(); if (recordStructureDocumentation.containsKey(structureName)) { final RecordStructureDocumentation documentation = recordStructureDocumentation.get(structureName); records.add(new RecordStructure(structureName, toRecordMembers(structure, documentation.getFields()), documentation.getDescription(), documentation.getStructureType())); } else { records.add(new RecordStructure(structureName, toRecordMembers(structure, Collections.<Field> emptyList()))); } } return records; }
RecordStructureAggregator { public List<RecordStructure> aggregate(final List<Structure> structures, final Map<String, RecordStructureDocumentation> recordStructureDocumentation) { if (structures == null) { throw new IllegalArgumentException("Structures cannot be null."); } if (recordStructureDocumentation == null) { throw new IllegalArgumentException("Record structure documentation cannot be null."); } final List<RecordStructure> records = new ArrayList<RecordStructure>(structures.size()); for (final Structure structure : structures) { final String structureName = structure.getName(); if (recordStructureDocumentation.containsKey(structureName)) { final RecordStructureDocumentation documentation = recordStructureDocumentation.get(structureName); records.add(new RecordStructure(structureName, toRecordMembers(structure, documentation.getFields()), documentation.getDescription(), documentation.getStructureType())); } else { records.add(new RecordStructure(structureName, toRecordMembers(structure, Collections.<Field> emptyList()))); } } return records; } }
RecordStructureAggregator { public List<RecordStructure> aggregate(final List<Structure> structures, final Map<String, RecordStructureDocumentation> recordStructureDocumentation) { if (structures == null) { throw new IllegalArgumentException("Structures cannot be null."); } if (recordStructureDocumentation == null) { throw new IllegalArgumentException("Record structure documentation cannot be null."); } final List<RecordStructure> records = new ArrayList<RecordStructure>(structures.size()); for (final Structure structure : structures) { final String structureName = structure.getName(); if (recordStructureDocumentation.containsKey(structureName)) { final RecordStructureDocumentation documentation = recordStructureDocumentation.get(structureName); records.add(new RecordStructure(structureName, toRecordMembers(structure, documentation.getFields()), documentation.getDescription(), documentation.getStructureType())); } else { records.add(new RecordStructure(structureName, toRecordMembers(structure, Collections.<Field> emptyList()))); } } return records; }  }
RecordStructureAggregator { public List<RecordStructure> aggregate(final List<Structure> structures, final Map<String, RecordStructureDocumentation> recordStructureDocumentation) { if (structures == null) { throw new IllegalArgumentException("Structures cannot be null."); } if (recordStructureDocumentation == null) { throw new IllegalArgumentException("Record structure documentation cannot be null."); } final List<RecordStructure> records = new ArrayList<RecordStructure>(structures.size()); for (final Structure structure : structures) { final String structureName = structure.getName(); if (recordStructureDocumentation.containsKey(structureName)) { final RecordStructureDocumentation documentation = recordStructureDocumentation.get(structureName); records.add(new RecordStructure(structureName, toRecordMembers(structure, documentation.getFields()), documentation.getDescription(), documentation.getStructureType())); } else { records.add(new RecordStructure(structureName, toRecordMembers(structure, Collections.<Field> emptyList()))); } } return records; }  List<RecordStructure> aggregate(final List<Structure> structures,
            final Map<String, RecordStructureDocumentation> recordStructureDocumentation); }
RecordStructureAggregator { public List<RecordStructure> aggregate(final List<Structure> structures, final Map<String, RecordStructureDocumentation> recordStructureDocumentation) { if (structures == null) { throw new IllegalArgumentException("Structures cannot be null."); } if (recordStructureDocumentation == null) { throw new IllegalArgumentException("Record structure documentation cannot be null."); } final List<RecordStructure> records = new ArrayList<RecordStructure>(structures.size()); for (final Structure structure : structures) { final String structureName = structure.getName(); if (recordStructureDocumentation.containsKey(structureName)) { final RecordStructureDocumentation documentation = recordStructureDocumentation.get(structureName); records.add(new RecordStructure(structureName, toRecordMembers(structure, documentation.getFields()), documentation.getDescription(), documentation.getStructureType())); } else { records.add(new RecordStructure(structureName, toRecordMembers(structure, Collections.<Field> emptyList()))); } } return records; }  List<RecordStructure> aggregate(final List<Structure> structures,
            final Map<String, RecordStructureDocumentation> recordStructureDocumentation);  }