Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCarsten Hammer2020-01-12 15:55:54 +0000
committerCarsten Hammer2020-03-14 15:46:42 +0000
commit5576f89d007cc3a1b5af1e7ab7f6dd9e079c6d6c (patch)
tree91274a5cf893823d442996f18dd71840d11edbd1 /tests
parent2cb567e8029f2e1418fe289eedfaba14a69bb89b (diff)
downloadeclipse.platform.team-5576f89d007cc3a1b5af1e7ab7f6dd9e079c6d6c.tar.gz
eclipse.platform.team-5576f89d007cc3a1b5af1e7ab7f6dd9e079c6d6c.tar.xz
eclipse.platform.team-5576f89d007cc3a1b5af1e7ab7f6dd9e079c6d6c.zip
Change cascades of ifs which can be converted to switch over Strings. A switch statement might be faster than an if-then-else chain. And it improves clarity. The problem with the if..else chain is that I have to look into all the if conditions to understand what the program is doing. And the variable might change in the chain processing. Change-Id: Ia7003e12ff240ea8c7ad63a382123c00786110a7 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
index a94304124..fc835b645 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
@@ -224,12 +224,16 @@ public class PatchTest {
patchdataUrl = FileLocator.resolve(patchdataUrl);
Map<String, PatchTestConfiguration> map = null;
- if (patchdataUrl.getProtocol().equals("file")) {
+ switch (patchdataUrl.getProtocol()) {
+ case "file":
map = extractNamesForFileProtocol(patchdataUrl);
- } else if (patchdataUrl.getProtocol().equals("jar")) {
+ break;
+ case "jar":
map = extractNamesForJarProtocol(patchdataUrl);
- } else {
+ break;
+ default:
fail("Unknown protocol");
+ break;
}
assertNotNull(map);

Back to the top