diff --git a/test/bytecode/ASTBytecodeTest.java b/test/bytecode/ASTBytecodeTest.java index 32fd8088..d2b4af70 100644 --- a/test/bytecode/ASTBytecodeTest.java +++ b/test/bytecode/ASTBytecodeTest.java @@ -56,10 +56,7 @@ public abstract class ASTBytecodeTest { String rootDirectory = getRootDirectory(); - System.out.println(rootDirectory); - JavaClass javaClass = result.getByteCode().getJavaClass(); - System.out.println(javaClass.toString()); javaClass.dump(new File(rootDirectory+javaClass.getClassName()+".class")); for(ClassGenerator cg: result.getByteCode().getExtraClasses().values()){ @@ -68,7 +65,6 @@ public abstract class ASTBytecodeTest { } }catch(Exception e){ - System.out.print(e.getMessage()); throw new RuntimeException(e); } } @@ -91,8 +87,4 @@ public abstract class ASTBytecodeTest { public String getTestName() { return "No Testname defined!"; } - - - - } diff --git a/test/bytecode/MethodAndVariable.jav b/test/bytecode/MethodAndVariable.jav new file mode 100644 index 00000000..2ae7002e --- /dev/null +++ b/test/bytecode/MethodAndVariable.jav @@ -0,0 +1,18 @@ +class MethodAndVariable{ + public Integer method(Integer parameter){ + Integer lokaleVariable; + lokaleVariable = 2; + + Integer lokaleVariable2; + lokaleVariable2 = method2(lokaleVariable); + + return parameter+lokaleVariable2; + } + + public Integer method2(Integer parameter){ + Integer lokaleVariable; + lokaleVariable = 2; + + return parameter+lokaleVariable; + } +} \ No newline at end of file diff --git a/test/bytecode/MethodsAndVariableTest.java b/test/bytecode/MethodsAndVariableTest.java new file mode 100644 index 00000000..8e0fd808 --- /dev/null +++ b/test/bytecode/MethodsAndVariableTest.java @@ -0,0 +1,26 @@ +package bytecode; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + + +public class MethodsAndVariableTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MethodAndVariable"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +}