> mv ./target/javassist*-GA.jar ./javaassist.jar
2) Check that ./src/test/javassist/JvstTestRoot.PATH and .JAR_PATH point to the compiled jar file.
- The default is "../".
+ The default is "../../".
3) Run Tests
import junit.framework.*;
import java.io.File;
import java.io.FileInputStream;
+import java.io.InputStream;
import java.lang.reflect.Method;
import javassist.bytecode.*;
import javassist.expr.*;
}
public void testJarClassPath() throws Exception {
- // TODO: Verify that classes can be loaded from a JarClassPath
+ String jarFileName = "./simple.jar";
+ ClassLoader classLoader = getClass().getClassLoader();
+ File jarFile = new File(classLoader.getResource(jarFileName).getFile());
+ assertTrue(jarFile.exists());
+
+ ClassPool pool = ClassPool.getDefault();
+ ClassPath cp = pool.appendClassPath(jarFile.getAbsolutePath());
+ InputStream is = cp.openClassfile("com.test.Test");
+ assertNotNull(is);
+ is.close();
}
public void testSubtype() throws Exception {