public class ClassLoaderTestHelper extends Object
Constructor and Description |
---|
ClassLoaderTestHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addJarFilesToJar(File targetJar,
String libPrefix,
File... srcJars)
Add a list of jar files to another jar file under a specific folder.
|
static File |
buildJar(String testDir,
String className,
String code)
Create a test jar for testing purpose for a given class
name with specified code string: save the class to a file,
compile it, and jar it up.
|
static File |
buildJar(String testDir,
String className,
String code,
String folder)
Create a test jar for testing purpose for a given class
name with specified code string.
|
public static File buildJar(String testDir, String className, String code) throws Exception
testDir
- the folder under which to store the test class and jarclassName
- the test class namecode
- the optional test class code, which can be null.
If null, a bare empty class will be usedException
public static File buildJar(String testDir, String className, String code, String folder) throws Exception
testDir
- the folder under which to store the test classclassName
- the test class namecode
- the optional test class code, which can be null.
If null, an empty class will be usedfolder
- the folder under which to store the generated jarException
public static void addJarFilesToJar(File targetJar, String libPrefix, File... srcJars) throws Exception
targetJar
- the target jar filelibPrefix
- the folder where to put inner jar filessrcJars
- the source inner jar files to be addedException
- if anything doesn't work as expected