@Test public void testFormat() throws Exception { final RecordStructureField field = mock(RecordStructureField.class); final String formattedField = "i am a formatted field"; when(fieldFormatter.format(field)).thenReturn(formattedField); final RecordStructureList list = mock(RecordStructureList.class); final String formattedList = "i am a formatted list"; when(listFormatter.format(list)).thenReturn(formattedList); final RecordInclude include = mock(RecordInclude.class); final String formattedInclude = "a formatted include"; when(includeFormatter.format(include)).thenReturn(formattedInclude); final RecordStructure structure = mock(RecordStructure.class); when(structure.getRootLevelMemberCount()).thenReturn(Integer.valueOf(3)); when(structure.getRootLevelMember(0)).thenReturn(field); when(structure.getRootLevelMember(1)).thenReturn(list); when(structure.getRootLevelMember(2)).thenReturn(include); assertThat(formatter.format(structure)).isEqualTo(formattedField + formattedList + formattedInclude); }
public String format(final RecordStructure structure) throws MavenReportException { if (structure == null) { throw new IllegalArgumentException("Record structure cannot be null."); } final StringBuilder definitionBuilder = new StringBuilder(); for (int i = 0, size = structure.getRootLevelMemberCount(); i < size; i++) { final RecordStructureMember member = structure.getRootLevelMember(i); if (member instanceof RecordStructureField) { definitionBuilder.append(fieldFormatter.format((RecordStructureField) member)); } else if (member instanceof AbstractParentRecordStructureMember) { definitionBuilder.append(listFormatter.format((AbstractParentRecordStructureMember) member)); } else { definitionBuilder.append(includeFormatter.format((RecordInclude) member)); } } return definitionBuilder.toString(); }
RecordStructureFormatter { public String format(final RecordStructure structure) throws MavenReportException { if (structure == null) { throw new IllegalArgumentException("Record structure cannot be null."); } final StringBuilder definitionBuilder = new StringBuilder(); for (int i = 0, size = structure.getRootLevelMemberCount(); i < size; i++) { final RecordStructureMember member = structure.getRootLevelMember(i); if (member instanceof RecordStructureField) { definitionBuilder.append(fieldFormatter.format((RecordStructureField) member)); } else if (member instanceof AbstractParentRecordStructureMember) { definitionBuilder.append(listFormatter.format((AbstractParentRecordStructureMember) member)); } else { definitionBuilder.append(includeFormatter.format((RecordInclude) member)); } } return definitionBuilder.toString(); } }
RecordStructureFormatter { public String format(final RecordStructure structure) throws MavenReportException { if (structure == null) { throw new IllegalArgumentException("Record structure cannot be null."); } final StringBuilder definitionBuilder = new StringBuilder(); for (int i = 0, size = structure.getRootLevelMemberCount(); i < size; i++) { final RecordStructureMember member = structure.getRootLevelMember(i); if (member instanceof RecordStructureField) { definitionBuilder.append(fieldFormatter.format((RecordStructureField) member)); } else if (member instanceof AbstractParentRecordStructureMember) { definitionBuilder.append(listFormatter.format((AbstractParentRecordStructureMember) member)); } else { definitionBuilder.append(includeFormatter.format((RecordInclude) member)); } } return definitionBuilder.toString(); } RecordStructureFormatter(final VelocityEngine engine);  RecordStructureFormatter(final FieldFormatter fieldFormatter, final ParentalMemberFormatter listFormatter,
            final IncludeFormatter includeFormatter); }
RecordStructureFormatter { public String format(final RecordStructure structure) throws MavenReportException { if (structure == null) { throw new IllegalArgumentException("Record structure cannot be null."); } final StringBuilder definitionBuilder = new StringBuilder(); for (int i = 0, size = structure.getRootLevelMemberCount(); i < size; i++) { final RecordStructureMember member = structure.getRootLevelMember(i); if (member instanceof RecordStructureField) { definitionBuilder.append(fieldFormatter.format((RecordStructureField) member)); } else if (member instanceof AbstractParentRecordStructureMember) { definitionBuilder.append(listFormatter.format((AbstractParentRecordStructureMember) member)); } else { definitionBuilder.append(includeFormatter.format((RecordInclude) member)); } } return definitionBuilder.toString(); } RecordStructureFormatter(final VelocityEngine engine);  RecordStructureFormatter(final FieldFormatter fieldFormatter, final ParentalMemberFormatter listFormatter,
            final IncludeFormatter includeFormatter); String format(final RecordStructure structure); }
RecordStructureFormatter { public String format(final RecordStructure structure) throws MavenReportException { if (structure == null) { throw new IllegalArgumentException("Record structure cannot be null."); } final StringBuilder definitionBuilder = new StringBuilder(); for (int i = 0, size = structure.getRootLevelMemberCount(); i < size; i++) { final RecordStructureMember member = structure.getRootLevelMember(i); if (member instanceof RecordStructureField) { definitionBuilder.append(fieldFormatter.format((RecordStructureField) member)); } else if (member instanceof AbstractParentRecordStructureMember) { definitionBuilder.append(listFormatter.format((AbstractParentRecordStructureMember) member)); } else { definitionBuilder.append(includeFormatter.format((RecordInclude) member)); } } return definitionBuilder.toString(); } RecordStructureFormatter(final VelocityEngine engine);  RecordStructureFormatter(final FieldFormatter fieldFormatter, final ParentalMemberFormatter listFormatter,
            final IncludeFormatter includeFormatter); String format(final RecordStructure structure);  }