diff options
author | Carsten Hammer <carsten.hammer@t-online.de> | 2019-05-21 17:04:18 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-12-14 20:42:03 +0100 |
commit | 74bc50125d3a2cb0a7eb8c32118b3f9a9530a361 (patch) | |
tree | 48e86457ef252be344ece68d9558f72fd23b911c /org.eclipse.jgit.pgm.test | |
parent | 1b3a555f667712ece7f17f009b5444862cbac54f (diff) | |
download | jgit-74bc50125d3a2cb0a7eb8c32118b3f9a9530a361.tar.gz jgit-74bc50125d3a2cb0a7eb8c32118b3f9a9530a361.zip |
Replace chain of if statements with switch
and switch over strings where possible. Sometimes if statements are
chained and form a series of comparisons against constants. Using switch
statements improves readability.
Bug: 545856
Change-Id: Iacb78956ee5c20db4d793e6b668508ec67466606
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r-- | org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java | 7 |
1 files changed, 4 insertions, 3 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 befb7f62ac..1d9dca73d0 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 @@ -190,11 +190,12 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { } protected String cmdString(String... cmds) { - if (cmds.length == 0) + switch (cmds.length) { + case 0: return ""; - else if (cmds.length == 1) + case 1: return "\"" + escapeJava(cmds[0]) + "\""; - else { + default: StringBuilder sb = new StringBuilder(cmdString(cmds[0])); for (int i=1; i<cmds.length; i++) { sb.append(", "); |