Skip to content

Commit

Permalink
Use system line separator in MultipleFailuresError
Browse files Browse the repository at this point in the history
Use of "\n" as the line separator in MultipleFailuresError caused
tests to fail on Windows.

This commit fixes this by using the system line separator.

Issue: #29
  • Loading branch information
tangkun75 authored and sbrannen committed Dec 16, 2016
1 parent a62fa60 commit f7684c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/org/opentest4j/MultipleFailuresError.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ public String getMessage() {
return this.heading;
}

String lineSeparator = System.getProperty("line.separator");

// @formatter:off
StringBuilder builder = new StringBuilder(this.heading)
.append(" (")
.append(failureCount).append(" ")
.append(pluralize(failureCount, "failure", "failures"))
.append(")\n");
.append(")")
.append(lineSeparator);
// @formatter:on

int lastIndex = failureCount - 1;
for (AssertionError failure : this.failures.subList(0, lastIndex)) {
builder.append("\t").append(nullSafeMessage(failure)).append("\n");
builder.append("\t").append(nullSafeMessage(failure)).append(lineSeparator);
}
builder.append('\t').append(nullSafeMessage(this.failures.get(lastIndex)));

Expand Down

0 comments on commit f7684c8

Please sign in to comment.