diff --git a/test/bytecode/types/OverloadingTest.java b/test/bytecode/types/OverloadingTest.java index 9e6b3a22..514264a3 100644 --- a/test/bytecode/types/OverloadingTest.java +++ b/test/bytecode/types/OverloadingTest.java @@ -2,7 +2,10 @@ package bytecode.types; import static org.junit.Assert.*; +import java.io.File; import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; import java.util.Vector; import org.junit.Test; @@ -24,17 +27,22 @@ public class OverloadingTest extends BytecodeTest{ Class cls = getClassToTest(); Object obj = cls.newInstance(); - Vector stringVector = new Vector(); + File file = new File(rootDirectory); + URL url = file.toURL(); + URL[] urls = new URL[]{url}; + + ClassLoader classLoader = new URLClassLoader(urls); + + Class stringVector = classLoader.loadClass("java%util%Vector%%java%lang%String%"); Class[] params = new Class[1]; - params[0] = stringVector.getClass(); + params[0] = stringVector; Method method = cls.getDeclaredMethod("method", params); - method.invoke(obj, stringVector); + method.invoke(obj, stringVector.newInstance()); assertTrue(true); }catch(Exception e){ - e.printStackTrace(); - fail(); + throw new RuntimeException(e); } } @@ -44,17 +52,22 @@ public class OverloadingTest extends BytecodeTest{ Class cls = getClassToTest(); Object obj = cls.newInstance(); - Vector stringVector = new Vector(); + File file = new File(rootDirectory); + URL url = file.toURL(); + URL[] urls = new URL[]{url}; + + ClassLoader classLoader = new URLClassLoader(urls); + + Class integerVector = classLoader.loadClass("java%util%Vector%%java%lang%Integer%"); Class[] params = new Class[1]; - params[0] = stringVector.getClass(); + params[0] = integerVector; Method method = cls.getDeclaredMethod("method", params); - method.invoke(obj, stringVector); + method.invoke(obj, integerVector.newInstance()); assertTrue(true); }catch(Exception e){ - e.printStackTrace(); - fail(); + throw new RuntimeException(e); } }