From f077829d303bfb70928ed1076add9357201fde48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Wed, 28 Oct 2015 10:48:14 +0100 Subject: [PATCH] =?UTF-8?q?JUnit=20Test=20f=C3=BCr=20Lokale=20Variabeln=20?= =?UTF-8?q?erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../types/LocalVariableStringVector.jav | 7 ++++ .../types/LocalVariableStringVectorTest.java | 39 +++++++++++++++++++ test/bytecode/types/LocalVariableVector.jav | 7 ++++ .../types/LocalVariableVectorTest.java | 38 ++++++++++++++++++ ...edVector.jav => MethodWithTypedVector.jav} | 2 +- ...st.java => MethodWithTypedVectorTest.java} | 4 +- ...Vector.jav => MethodWithUntypedVector.jav} | 2 +- ....java => MethodWithUntypedVectorTest.java} | 4 +- 8 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 test/bytecode/types/LocalVariableStringVector.jav create mode 100644 test/bytecode/types/LocalVariableStringVectorTest.java create mode 100644 test/bytecode/types/LocalVariableVector.jav create mode 100644 test/bytecode/types/LocalVariableVectorTest.java rename test/bytecode/types/{TypedVector.jav => MethodWithTypedVector.jav} (70%) rename test/bytecode/types/{TypedVectorTest.java => MethodWithTypedVectorTest.java} (90%) rename test/bytecode/types/{UntypedVector.jav => MethodWithUntypedVector.jav} (65%) rename test/bytecode/types/{UntypedVectorTest.java => MethodWithUntypedVectorTest.java} (93%) diff --git a/test/bytecode/types/LocalVariableStringVector.jav b/test/bytecode/types/LocalVariableStringVector.jav new file mode 100644 index 00000000..887c82d6 --- /dev/null +++ b/test/bytecode/types/LocalVariableStringVector.jav @@ -0,0 +1,7 @@ +import java.util.Vector; + +class LocalVariableStringVector{ + void method() { + Vector vector; + } +} \ No newline at end of file diff --git a/test/bytecode/types/LocalVariableStringVectorTest.java b/test/bytecode/types/LocalVariableStringVectorTest.java new file mode 100644 index 00000000..a3761210 --- /dev/null +++ b/test/bytecode/types/LocalVariableStringVectorTest.java @@ -0,0 +1,39 @@ +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; + +import bytecode.BytecodeTest; + +public class LocalVariableStringVectorTest extends BytecodeTest{ + @Override + protected void init() { + testName = "LocalVariableStringVector"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; + } + + + + @Test + public void testCompiler() { + try{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + assertTrue(true); + }catch(Exception e){ + throw new RuntimeException(e); + } + } + +} diff --git a/test/bytecode/types/LocalVariableVector.jav b/test/bytecode/types/LocalVariableVector.jav new file mode 100644 index 00000000..13cd673c --- /dev/null +++ b/test/bytecode/types/LocalVariableVector.jav @@ -0,0 +1,7 @@ +import java.util.Vector; + +class LocalVariableVector{ + void method() { + Vector vector; + } +} \ No newline at end of file diff --git a/test/bytecode/types/LocalVariableVectorTest.java b/test/bytecode/types/LocalVariableVectorTest.java new file mode 100644 index 00000000..52869f43 --- /dev/null +++ b/test/bytecode/types/LocalVariableVectorTest.java @@ -0,0 +1,38 @@ +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; + +import bytecode.BytecodeTest; + +public class LocalVariableVectorTest extends BytecodeTest{ + @Override + protected void init() { + testName = "LocalVariableVector"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; + } + + + + @Test + public void testCompiler() { + try{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + assertTrue(true); + }catch(Exception e){ + throw new RuntimeException(e); + } + } +} diff --git a/test/bytecode/types/TypedVector.jav b/test/bytecode/types/MethodWithTypedVector.jav similarity index 70% rename from test/bytecode/types/TypedVector.jav rename to test/bytecode/types/MethodWithTypedVector.jav index d64e4f5f..a74062ee 100644 --- a/test/bytecode/types/TypedVector.jav +++ b/test/bytecode/types/MethodWithTypedVector.jav @@ -1,6 +1,6 @@ import java.util.Vector; -class TypedVector{ +class MethodWithTypedVector{ public void method(Vector v) { } diff --git a/test/bytecode/types/TypedVectorTest.java b/test/bytecode/types/MethodWithTypedVectorTest.java similarity index 90% rename from test/bytecode/types/TypedVectorTest.java rename to test/bytecode/types/MethodWithTypedVectorTest.java index 6a5cb441..6933c248 100644 --- a/test/bytecode/types/TypedVectorTest.java +++ b/test/bytecode/types/MethodWithTypedVectorTest.java @@ -15,10 +15,10 @@ import bytecode.BytecodeTest; import de.dhbwstuttgart.logger.Logger; import de.dhbwstuttgart.logger.Section; -public class TypedVectorTest extends BytecodeTest{ +public class MethodWithTypedVectorTest extends BytecodeTest{ @Override protected void init() { - testName = "TypedVector"; + testName = "MethodWithTypedVector"; rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; } diff --git a/test/bytecode/types/UntypedVector.jav b/test/bytecode/types/MethodWithUntypedVector.jav similarity index 65% rename from test/bytecode/types/UntypedVector.jav rename to test/bytecode/types/MethodWithUntypedVector.jav index 05835507..fead3981 100644 --- a/test/bytecode/types/UntypedVector.jav +++ b/test/bytecode/types/MethodWithUntypedVector.jav @@ -1,6 +1,6 @@ import java.util.Vector; -class UntypedVector{ +class MethodWithUntypedVector{ public void method(Vector v) { } diff --git a/test/bytecode/types/UntypedVectorTest.java b/test/bytecode/types/MethodWithUntypedVectorTest.java similarity index 93% rename from test/bytecode/types/UntypedVectorTest.java rename to test/bytecode/types/MethodWithUntypedVectorTest.java index a2277c0c..1be45ff0 100644 --- a/test/bytecode/types/UntypedVectorTest.java +++ b/test/bytecode/types/MethodWithUntypedVectorTest.java @@ -15,10 +15,10 @@ import bytecode.BytecodeTest; import de.dhbwstuttgart.logger.Logger; import de.dhbwstuttgart.logger.Section; -public class UntypedVectorTest extends BytecodeTest{ +public class MethodWithUntypedVectorTest extends BytecodeTest{ @Override protected void init() { - testName = "UntypedVector"; + testName = "MethodWithUntypedVector"; rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; }