AuoOverloadingTest vervollständigt

This commit is contained in:
Enrico Schrödter 2015-11-25 08:00:50 +01:00
parent 2958c52610
commit 8b0005ecee
2 changed files with 56 additions and 4 deletions

View File

@ -2,16 +2,16 @@ import java.util.Vector;
class AutoOverloading{
methode2(String p){
method2(String p){
}
methode2(Integer p){
method2(Integer p){
}
methode(p){
methode2(p);
method(p){
method2(p);
}
}

View File

@ -29,4 +29,56 @@ public class AutoOverloadingTest extends SourceFileBytecodeTest{
Object obj = cls.newInstance();
assertTrue(true);
}
@Test
public void testString() {
try{
ClassLoader classLoader = getClassLoader();
Class cls = classLoader.loadClass(testName);
Object obj = cls.newInstance();
File file = new File(rootDirectory);
URL url = file.toURL();
URL[] urls = new URL[]{url};
Class string = classLoader.loadClass("java.lang.String");
Class[] params = new Class[1];
params[0] = string;
Method method = cls.getDeclaredMethod("method", params);
method.invoke(obj, string.newInstance());
assertTrue(true);
}catch(Exception e){
throw new RuntimeException(e);
}
}
@Test
public void testInteger() {
try{
ClassLoader classLoader = getClassLoader();
Class cls = classLoader.loadClass(testName);
Object obj = cls.newInstance();
File file = new File(rootDirectory);
URL url = file.toURL();
URL[] urls = new URL[]{url};
Class integer = classLoader.loadClass("java.lang.Integer");
Class[] params = new Class[1];
params[0] = integer;
Method method = cls.getDeclaredMethod("method", params);
method.invoke(obj, integer.newInstance());
assertTrue(true);
}catch(Exception e){
throw new RuntimeException(e);
}
}
}