aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java')
-rw-r--r--org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java
index a72af9a1c4..a3436a0179 100644
--- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java
+++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java
@@ -223,20 +223,24 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase {
assertEquals(toString(expected), toString(actual));
}
- public static String toString(String[] lines) {
+ public static String toString(String... lines) {
return toString(Arrays.asList(lines));
}
public static String toString(List<String> lines) {
StringBuilder b = new StringBuilder();
for (String s : lines) {
+ // trim indentation, to simplify tests
+ s = s.trim();
if (s != null && !s.isEmpty()) {
b.append(s);
- if (!s.endsWith("\n")) {
- b.append('\n');
- }
+ b.append('\n');
}
}
+ // delete last line break to allow simpler tests with one line compare
+ if (b.length() > 0 && b.charAt(b.length() - 1) == '\n') {
+ b.deleteCharAt(b.length() - 1);
+ }
return b.toString();
}