From 8b0005ecee003410a8e530aaafc998aa97d1d2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Wed, 25 Nov 2015 08:00:50 +0100 Subject: [PATCH] =?UTF-8?q?AuoOverloadingTest=20vervollst=C3=A4ndigt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/bytecode/types/AutoOverloading.jav | 8 +-- test/bytecode/types/AutoOverloadingTest.java | 52 ++++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/test/bytecode/types/AutoOverloading.jav b/test/bytecode/types/AutoOverloading.jav index 860f54834..193bbfe7b 100644 --- a/test/bytecode/types/AutoOverloading.jav +++ b/test/bytecode/types/AutoOverloading.jav @@ -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); } } \ No newline at end of file diff --git a/test/bytecode/types/AutoOverloadingTest.java b/test/bytecode/types/AutoOverloadingTest.java index 41c0bfc75..8aea83fdc 100644 --- a/test/bytecode/types/AutoOverloadingTest.java +++ b/test/bytecode/types/AutoOverloadingTest.java @@ -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); + } + } }