Skip to content

Commit

Permalink
end review reports line with newline [preston review]
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrit Poelen committed Dec 24, 2024
1 parent d059ef5 commit 1f83777
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ private static void log(String msg, String namespace, PrintStream stdout, String


private static void logReviewCommentWithReviewerInfo(PrintStream out, String reviewId, DateFactory dateFactory, String reviewerName, String... fields) {
out.print('\n');
Stream<String> enrichedFields = Stream.concat(
Stream.of(
reviewId,
Expand All @@ -361,6 +360,7 @@ static void logReviewComment(PrintStream out, Object... fields) {
throw new IllegalArgumentException("not enough log fields: need [" + LOG_NUMBER_OF_FIELDS + "], but found [" + fields.length + "] in [" + StringUtils.join(fields, CharsetConstant.SEPARATOR));
}
out.print(String.format(LOG_FORMAT_STRING, Stream.of(fields).map(x -> x == null ? "" : CSVTSVUtil.escapeTSV(x.toString())).toArray()));
out.print("\n");
}

public Long getMaxLines() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void runCheckLocalWithRemoteDeps() throws IOException {
assertThat(outOs.toString(), endsWith(
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t2 interaction(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t0 note(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t2 info(s)\t\t\t\t\t\t\t\t\t"));
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t2 info(s)\t\t\t\t\t\t\t\t\t\n"));
}
}

Expand Down Expand Up @@ -244,7 +244,7 @@ public void runCheckLocalWithRemoteDepsMax1Line() throws IOException {
assertThat(outOs.toString(), endsWith(
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t2 interaction(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t0 note(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t2 info(s)\t\t\t\t\t\t\t\t\t"));
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t2 info(s)\t\t\t\t\t\t\t\t\t\n"));
}
}

Expand All @@ -259,13 +259,15 @@ public void runCheckLocalWithResourceRelation() throws IOException {
String[] lines = StringUtils.splitPreserveAllTokens(reviewReport, '\n');
int expectedNumberOfColumns = 15;
for (String line : lines) {
int numberOfColumns = StringUtils.splitPreserveAllTokens(line, '\t').length;
assertThat("mismatching number of columns in line [" + line + "]", numberOfColumns, is(expectedNumberOfColumns));
if (StringUtils.isNotBlank(line)) {
int numberOfColumns = StringUtils.splitPreserveAllTokens(line, '\t').length;
assertThat("mismatching number of columns in line [" + line + "]", numberOfColumns, is(expectedNumberOfColumns));
}
}
assertThat(reviewReport, endsWith(
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t7 interaction(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t3 note(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t9 info(s)\t\t\t\t\t\t\t\t\t"));
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t9 info(s)\t\t\t\t\t\t\t\t\t\n"));
}
}

Expand All @@ -283,7 +285,7 @@ private void assertOneWarning(String localTestPath) throws IOException {
assertThat(outOs.toString(), endsWith(
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t11 interaction(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t1 note(s)\t\t\t\t\t\t\t\t\t\n" +
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t11 info(s)\t\t\t\t\t\t\t\t\t"));
"6a550a42-8951-416a-a187-34edbd3f87d0\t1970-01-01T00:00:00Z\telton-dev\tlocal\tsummary\t11 info(s)\t\t\t\t\t\t\t\t\t\n"));
}
}

Expand Down

0 comments on commit 1f83777

Please sign in to comment.