@Test void test() { ResultWithErrors<List<CobolLine>> result = super.processText(TEXT_TO_TEST); CobolLineWriter writer = new CobolLineWriterImpl(); assertEquals(EXPECTED, writer.serialize(result.getResult())); assertEquals(0, result.getErrors().size()); }
@Override public String serialize(final List<CobolLine> lines) { final StringBuilder sb = new StringBuilder(); int counter = 0; for (final CobolLine line : lines) { final boolean isContinuationLine = CobolLineTypeEnum.CONTINUATION.equals(line.getType()); if (!isContinuationLine) { if (line.getNumber() > 0) { sb.append(NEWLINE); } counter = 0; sb.append(BLANK_SEQUENCE_AREA); sb.append(line.getIndicatorArea()); sb.append(line.getContentArea()); } if (isContinuationLine) { ++counter; sb.append(removeStartingQuote(line)); removeIntermediateLinebreaks(sb, counter); appendNewLinesAtEnd(sb, counter); } } return sb.toString(); }
CobolLineWriterImpl implements CobolLineWriter { @Override public String serialize(final List<CobolLine> lines) { final StringBuilder sb = new StringBuilder(); int counter = 0; for (final CobolLine line : lines) { final boolean isContinuationLine = CobolLineTypeEnum.CONTINUATION.equals(line.getType()); if (!isContinuationLine) { if (line.getNumber() > 0) { sb.append(NEWLINE); } counter = 0; sb.append(BLANK_SEQUENCE_AREA); sb.append(line.getIndicatorArea()); sb.append(line.getContentArea()); } if (isContinuationLine) { ++counter; sb.append(removeStartingQuote(line)); removeIntermediateLinebreaks(sb, counter); appendNewLinesAtEnd(sb, counter); } } return sb.toString(); } }
CobolLineWriterImpl implements CobolLineWriter { @Override public String serialize(final List<CobolLine> lines) { final StringBuilder sb = new StringBuilder(); int counter = 0; for (final CobolLine line : lines) { final boolean isContinuationLine = CobolLineTypeEnum.CONTINUATION.equals(line.getType()); if (!isContinuationLine) { if (line.getNumber() > 0) { sb.append(NEWLINE); } counter = 0; sb.append(BLANK_SEQUENCE_AREA); sb.append(line.getIndicatorArea()); sb.append(line.getContentArea()); } if (isContinuationLine) { ++counter; sb.append(removeStartingQuote(line)); removeIntermediateLinebreaks(sb, counter); appendNewLinesAtEnd(sb, counter); } } return sb.toString(); }  }
CobolLineWriterImpl implements CobolLineWriter { @Override public String serialize(final List<CobolLine> lines) { final StringBuilder sb = new StringBuilder(); int counter = 0; for (final CobolLine line : lines) { final boolean isContinuationLine = CobolLineTypeEnum.CONTINUATION.equals(line.getType()); if (!isContinuationLine) { if (line.getNumber() > 0) { sb.append(NEWLINE); } counter = 0; sb.append(BLANK_SEQUENCE_AREA); sb.append(line.getIndicatorArea()); sb.append(line.getContentArea()); } if (isContinuationLine) { ++counter; sb.append(removeStartingQuote(line)); removeIntermediateLinebreaks(sb, counter); appendNewLinesAtEnd(sb, counter); } } return sb.toString(); }  @Override String serialize(final List<CobolLine> lines); }
CobolLineWriterImpl implements CobolLineWriter { @Override public String serialize(final List<CobolLine> lines) { final StringBuilder sb = new StringBuilder(); int counter = 0; for (final CobolLine line : lines) { final boolean isContinuationLine = CobolLineTypeEnum.CONTINUATION.equals(line.getType()); if (!isContinuationLine) { if (line.getNumber() > 0) { sb.append(NEWLINE); } counter = 0; sb.append(BLANK_SEQUENCE_AREA); sb.append(line.getIndicatorArea()); sb.append(line.getContentArea()); } if (isContinuationLine) { ++counter; sb.append(removeStartingQuote(line)); removeIntermediateLinebreaks(sb, counter); appendNewLinesAtEnd(sb, counter); } } return sb.toString(); }  @Override String serialize(final List<CobolLine> lines);  }