From 1f8377713d0fad90a785c74eb735c0687720a5b1 Mon Sep 17 00:00:00 2001 From: Jorrit Poelen Date: Tue, 24 Dec 2024 16:07:48 -0600 Subject: [PATCH] end review reports line with newline [preston review] --- .../elton/cmd/CmdReview.java | 2 +- .../elton/cmd/CmdReviewTest.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/globalbioticinteractions/elton/cmd/CmdReview.java b/src/main/java/org/globalbioticinteractions/elton/cmd/CmdReview.java index 117959d..88a71b6 100644 --- a/src/main/java/org/globalbioticinteractions/elton/cmd/CmdReview.java +++ b/src/main/java/org/globalbioticinteractions/elton/cmd/CmdReview.java @@ -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 enrichedFields = Stream.concat( Stream.of( reviewId, @@ -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() { diff --git a/src/test/java/org/globalbioticinteractions/elton/cmd/CmdReviewTest.java b/src/test/java/org/globalbioticinteractions/elton/cmd/CmdReviewTest.java index 0f8ca40..a8e178e 100644 --- a/src/test/java/org/globalbioticinteractions/elton/cmd/CmdReviewTest.java +++ b/src/test/java/org/globalbioticinteractions/elton/cmd/CmdReviewTest.java @@ -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")); } } @@ -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")); } } @@ -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")); } } @@ -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")); } }