move utility so other tests can use it
This commit is contained in:
parent
1c6a6b0cbd
commit
1867b57425
|
@ -48,21 +48,6 @@ public abstract class DynamicCallGraphTestBase extends WalaTestCase {
|
|||
|
||||
protected boolean testPatchCalls = false;
|
||||
|
||||
protected static String getClasspathEntry(String elt) {
|
||||
for (String s : System.getProperty("java.class.path").split(File.pathSeparator)) {
|
||||
if (s.indexOf(elt) >= 0) {
|
||||
File e = new File(s);
|
||||
Assert.assertTrue(elt + " expected to exist", e.exists());
|
||||
if (e.isDirectory() && !s.endsWith("/")) {
|
||||
s = s + "/";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
Assert.assertFalse("cannot find " + elt, true);
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean instrumentedJarBuilt = false;
|
||||
|
||||
private java.nio.file.Path instrumentedJarLocation;
|
||||
|
@ -88,7 +73,7 @@ public abstract class DynamicCallGraphTestBase extends WalaTestCase {
|
|||
|
||||
String rtJar = null;
|
||||
for(String jar : WalaProperties.getJ2SEJarFiles()) {
|
||||
if (jar.endsWith("rt.jar") || jar.endsWith("classes.jar")) {
|
||||
if (jar.endsWith(File.separator + "rt.jar") || jar.endsWith(File.separator + "classes.jar")) {
|
||||
rtJar = jar;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package com.ibm.wala.core.tests.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.After;
|
||||
|
@ -90,6 +91,26 @@ public abstract class WalaTestCase {
|
|||
JUnitCore.runClasses(testClass);
|
||||
}
|
||||
|
||||
protected static String getClasspathEntry(String elt) {
|
||||
String result = null;
|
||||
for (String s : System.getProperty("java.class.path").split(File.pathSeparator)) {
|
||||
if (s.indexOf(elt) >= 0) {
|
||||
File e = new File(s);
|
||||
Assert.assertTrue(elt + " expected to exist", e.exists());
|
||||
if (e.isDirectory() && !s.endsWith("/")) {
|
||||
s = s + "/";
|
||||
}
|
||||
if (result == null) {
|
||||
result = s;
|
||||
} else {
|
||||
result += File.pathSeparator + s;
|
||||
}
|
||||
}
|
||||
}
|
||||
Assert.assertFalse("cannot find " + elt, result == null);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected <T> void assertEquals(T x, T y) {
|
||||
Assert.assertEquals("Expecting " + x + ", but got " + y, x, y);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue