Bug 561967 - [Tests] 3 tests failing on cen64-gtk3 since I20200406-0350
user.home may not be available for docker image
Change-Id: Ic0bba1be6889dad943f3c30fb166ba4be221cbd1
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
index 6c7a43d..e150c43 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2018, 2019 Cedric Chabanois and others.
+ * Copyright (c) 2018, 2020 Cedric Chabanois and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -123,8 +123,12 @@
assertArrayEquals(new String[] { JAVA_10_PATH, ENCODING_ARG, "-classpath", classpathShortener.getProcessTempFiles().get(0).getAbsolutePath(),
MAIN_CLASS, "-arg1", "arg2" }, classpathShortener.getCmdLine());
List<File> classpathJars = getClasspathJarsFromJarManifest(classpathShortener.getProcessTempFiles().get(0));
- assertEquals(new File(userHomePath("/workspace/myProject/bin")), classpathJars.get(0).getCanonicalFile());
- assertEquals(new File(userHomePath("/workspace/myProject/lib/lib 1.jar")), classpathJars.get(1).getCanonicalFile());
+ String filePathSuffix = new File(userHomePath("/workspace/myProject/bin")).getPath();
+ int index = classpathJars.get(0).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
+ assertTrue("First Classpath jar file location not found", index != -1);
+ filePathSuffix = new File(userHomePath("/workspace/myProject/lib/lib 1.jar")).getPath();
+ index = classpathJars.get(1).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
+ assertTrue("Second Classpath jar file location not found", index != -1);
}
public void testArgFileUsedForLongClasspathOnJava9() throws Exception {