diff --git a/.gitignore b/.gitignore index d769462..b4ec882 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ target/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ +/personalNotes/ ### IntelliJ IDEA ### .idea @@ -32,4 +33,4 @@ build/ .vscode/ ### Mac OS ### -.DS_Store \ No newline at end of file +.DS_Store diff --git a/src/test/java/AllE2ETests.java b/src/test/java/AllE2ETests.java index 92e40b3..747f1bd 100644 --- a/src/test/java/AllE2ETests.java +++ b/src/test/java/AllE2ETests.java @@ -8,23 +8,6 @@ import static HelpClasses.TestFileTester.run; */ class AllE2ETests { -// @Test -// void testPublicClass() { -// byte[] resultE2E = Compiler.generateE2EArrayFromTypedAst(); -// assertEquals(AbstractSyntax_PublicClass.get(), resultE2E); -// } - -// @Test -// void testMethodCall() { -// assertDoesNotThrow(() -> { -// E2ETestUtil testUtility = new E2ETestUtil("src/test/testFiles/ASTandTypedASTFeatures/MethodCall.java", "MethodCall"); -// -// assertEquals(0, testUtility.invokeMethod("method", null)); -// assertEquals(1, testUtility.invokeMethod("method1", new Class[]{int.class}, 1)); -// assertEquals(3, testUtility.invokeMethod("method2", new Class[]{int.class, int.class}, 1, 2)); -// }); -// } TODO: Fix this test or remove it - @Test void runE2EBreakTests() { run(E2E_Break.class); @@ -105,11 +88,6 @@ class AllE2ETests { run(E2E_MethodCall.class); } -// @Test -// void runE2EMultipleClassesTests() { -// run(E2E_MultipleClasses.class); -// } TODO: Fix this test or remove it - @Test void runE2EOperatorsTests() { run(E2E_Operators.class); diff --git a/src/test/java/E2ETests/ByteClassLoader.java b/src/test/java/E2ETests/ByteClassLoader.java deleted file mode 100644 index c6c6b7b..0000000 --- a/src/test/java/E2ETests/ByteClassLoader.java +++ /dev/null @@ -1,29 +0,0 @@ -package E2ETests; - -import java.util.HashMap; -import java.util.Map; - -public class ByteClassLoader extends ClassLoader { - // TODO: Use or remove this class - - // Map to store the class name and its corresponding byte array - private final Map classesBytes = new HashMap<>(); - - public ByteClassLoader() { - super(ClassLoader.getSystemClassLoader()); - } - - // Method to add a class byte array to the loader - public void addClass(String name, byte[] classData) { - classesBytes.put(name, classData); - } - - @Override - protected Class findClass(String name) throws ClassNotFoundException { - byte[] classData = classesBytes.get(name); - if (classData == null) { - return super.findClass(name); - } - return defineClass(name, classData, 0, classData.length); - } -} diff --git a/src/test/java/E2ETests/ClassNameExtractor.java b/src/test/java/E2ETests/ClassNameExtractor.java deleted file mode 100644 index 9ced693..0000000 --- a/src/test/java/E2ETests/ClassNameExtractor.java +++ /dev/null @@ -1,33 +0,0 @@ -package E2ETests; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.Opcodes; - -public class ClassNameExtractor { - // TODO: Use or remove this class - - public static String getClassName(byte[] classBytes) { - ClassReader classReader = new ClassReader(classBytes); - ClassNameVisitor classNameVisitor = new ClassNameVisitor(); - classReader.accept(classNameVisitor, 0); - return classNameVisitor.getClassName(); - } - - private static class ClassNameVisitor extends ClassVisitor { - private String className; - - public ClassNameVisitor() { - super(Opcodes.ASM9); - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - this.className = name.replace('/', '.'); - } - - public String getClassName() { - return className; - } - } -} \ No newline at end of file diff --git a/src/test/java/E2ETests/Features/E2E_Break.java b/src/test/java/E2ETests/Features/E2E_Break.java index 3378367..75e1563 100644 --- a/src/test/java/E2ETests/Features/E2E_Break.java +++ b/src/test/java/E2ETests/Features/E2E_Break.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'Break' at src/test/testFiles/E2EFeatures/Break.java was successful, @@ -14,7 +14,7 @@ public class E2E_Break { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Break { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Break.java", "Break"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Break.java", "Break"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Class.java b/src/test/java/E2ETests/Features/E2E_Class.java index 1f0aa69..c7c9ce2 100644 --- a/src/test/java/E2ETests/Features/E2E_Class.java +++ b/src/test/java/E2ETests/Features/E2E_Class.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'Class' at src/test/testFiles/E2EFeatures/Class.java was successful, @@ -14,7 +14,7 @@ public class E2E_Class { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Class { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Class.java", "Class"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Class.java", "Class"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_ClassObjects.java b/src/test/java/E2ETests/Features/E2E_ClassObjects.java index 6407ac6..ee69257 100644 --- a/src/test/java/E2ETests/Features/E2E_ClassObjects.java +++ b/src/test/java/E2ETests/Features/E2E_ClassObjects.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_ClassObjects { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_ClassObjects { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/ClassObjects.java", "ClassObjects"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/ClassObjects.java", "ClassObjects"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Comment.java b/src/test/java/E2ETests/Features/E2E_Comment.java index 0625acd..961077b 100644 --- a/src/test/java/E2ETests/Features/E2E_Comment.java +++ b/src/test/java/E2ETests/Features/E2E_Comment.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'Comment' at src/test/testFiles/E2EFeatures/Comment.java was successful, @@ -14,7 +14,7 @@ public class E2E_Comment { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Comment { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Comment.java", "Comment"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Comment.java", "Comment"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_CompAssign.java b/src/test/java/E2ETests/Features/E2E_CompAssign.java index 94071b5..b4256ce 100644 --- a/src/test/java/E2ETests/Features/E2E_CompAssign.java +++ b/src/test/java/E2ETests/Features/E2E_CompAssign.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_CompAssign { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_CompAssign { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/CompAssign.java", "CompAssign"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/CompAssign.java", "CompAssign"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_ComplexCalls.java b/src/test/java/E2ETests/Features/E2E_ComplexCalls.java index 43bc087..03cdca5 100644 --- a/src/test/java/E2ETests/Features/E2E_ComplexCalls.java +++ b/src/test/java/E2ETests/Features/E2E_ComplexCalls.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_ComplexCalls { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_ComplexCalls { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/ComplexCalls.java", "ComplexCalls"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/ComplexCalls.java", "ComplexCalls"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Constructor.java b/src/test/java/E2ETests/Features/E2E_Constructor.java index 98ed069..4d1810d 100644 --- a/src/test/java/E2ETests/Features/E2E_Constructor.java +++ b/src/test/java/E2ETests/Features/E2E_Constructor.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_Constructor { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Constructor { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Constructor.java", "Constructor"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Constructor.java", "Constructor"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Continue.java b/src/test/java/E2ETests/Features/E2E_Continue.java index d2f5ce8..b12f9f8 100644 --- a/src/test/java/E2ETests/Features/E2E_Continue.java +++ b/src/test/java/E2ETests/Features/E2E_Continue.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_Continue { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Continue { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Continue.java", "Continue"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Continue.java", "Continue"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_DataTypes.java b/src/test/java/E2ETests/Features/E2E_DataTypes.java index 517d583..1f1af2f 100644 --- a/src/test/java/E2ETests/Features/E2E_DataTypes.java +++ b/src/test/java/E2ETests/Features/E2E_DataTypes.java @@ -3,16 +3,14 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; - -import java.util.List; +import E2ETests.ReflectionsTestUtil; public class E2E_DataTypes { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -20,7 +18,7 @@ public class E2E_DataTypes { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/DataTypes.java", "DataTypes"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/DataTypes.java", "DataTypes"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Field.java b/src/test/java/E2ETests/Features/E2E_Field.java index 724b684..199142d 100644 --- a/src/test/java/E2ETests/Features/E2E_Field.java +++ b/src/test/java/E2ETests/Features/E2E_Field.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'Field' at src/test/testFiles/E2EFeatures/Field.java was successful, @@ -14,7 +14,7 @@ public class E2E_Field { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Field { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Field.java", "Field"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Field.java", "Field"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_For.java b/src/test/java/E2ETests/Features/E2E_For.java index 18d4f74..15cc83e 100644 --- a/src/test/java/E2ETests/Features/E2E_For.java +++ b/src/test/java/E2ETests/Features/E2E_For.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'For' at src/test/testFiles/E2EFeatures/For.java was successful, @@ -14,7 +14,7 @@ public class E2E_For { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_For { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/For.java", "For"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/For.java", "For"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_If.java b/src/test/java/E2ETests/Features/E2E_If.java index f9bacc0..5a00927 100644 --- a/src/test/java/E2ETests/Features/E2E_If.java +++ b/src/test/java/E2ETests/Features/E2E_If.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'If' at src/test/testFiles/E2EFeatures/If.java was successful, @@ -14,7 +14,7 @@ public class E2E_If { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_If { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/If.java", "If"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/If.java", "If"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_InDeCrement.java b/src/test/java/E2ETests/Features/E2E_InDeCrement.java index 00a0917..b028bbd 100644 --- a/src/test/java/E2ETests/Features/E2E_InDeCrement.java +++ b/src/test/java/E2ETests/Features/E2E_InDeCrement.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_InDeCrement { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_InDeCrement { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/InDeCrement.java", "InDeCrement"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/InDeCrement.java", "InDeCrement"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_LogicExpr.java b/src/test/java/E2ETests/Features/E2E_LogicExpr.java index b217125..cfeddf5 100644 --- a/src/test/java/E2ETests/Features/E2E_LogicExpr.java +++ b/src/test/java/E2ETests/Features/E2E_LogicExpr.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_LogicExpr { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_LogicExpr { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/LogicExpr.java", "LogicExpr"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/LogicExpr.java", "LogicExpr"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Main.java b/src/test/java/E2ETests/Features/E2E_Main.java index 8f38071..97e292e 100644 --- a/src/test/java/E2ETests/Features/E2E_Main.java +++ b/src/test/java/E2ETests/Features/E2E_Main.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -17,7 +17,7 @@ public class E2E_Main { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -25,7 +25,7 @@ public class E2E_Main { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Main.java", "Main"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Main.java", "Main"); } catch (Exception e) { throw new RuntimeException(e); } @@ -171,6 +171,4 @@ public class E2E_Main { Assertions.fail(); } } - - //TODO: Add test for invoking main method by starting the compiled class file? } \ No newline at end of file diff --git a/src/test/java/E2ETests/Features/E2E_Method.java b/src/test/java/E2ETests/Features/E2E_Method.java index 28c3c56..e0ad7f3 100644 --- a/src/test/java/E2ETests/Features/E2E_Method.java +++ b/src/test/java/E2ETests/Features/E2E_Method.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_Method { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Method { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Method.java", "Method"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Method.java", "Method"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_MethodCall.java b/src/test/java/E2ETests/Features/E2E_MethodCall.java index 86779a7..81569a7 100644 --- a/src/test/java/E2ETests/Features/E2E_MethodCall.java +++ b/src/test/java/E2ETests/Features/E2E_MethodCall.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_MethodCall { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_MethodCall { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/MethodCall.java", "MethodCall"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/MethodCall.java", "MethodCall"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_MultipleClasses.java b/src/test/java/E2ETests/Features/E2E_MultipleClasses.java index 894846b..35586c9 100644 --- a/src/test/java/E2ETests/Features/E2E_MultipleClasses.java +++ b/src/test/java/E2ETests/Features/E2E_MultipleClasses.java @@ -1,10 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; import de.maishai.Compiler; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import java.util.List; diff --git a/src/test/java/E2ETests/Features/E2E_Operators.java b/src/test/java/E2ETests/Features/E2E_Operators.java index 195ad64..3de552b 100644 --- a/src/test/java/E2ETests/Features/E2E_Operators.java +++ b/src/test/java/E2ETests/Features/E2E_Operators.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_Operators { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Operators { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Operators.java", "Operators"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Operators.java", "Operators"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Overloaded.java b/src/test/java/E2ETests/Features/E2E_Overloaded.java index 5d41e91..5bde8c3 100644 --- a/src/test/java/E2ETests/Features/E2E_Overloaded.java +++ b/src/test/java/E2ETests/Features/E2E_Overloaded.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_Overloaded { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Overloaded { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Overloaded.java", "Overloaded"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Overloaded.java", "Overloaded"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Print.java b/src/test/java/E2ETests/Features/E2E_Print.java index 7cafc6b..0be6bc4 100644 --- a/src/test/java/E2ETests/Features/E2E_Print.java +++ b/src/test/java/E2ETests/Features/E2E_Print.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -17,7 +17,7 @@ public class E2E_Print { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -25,7 +25,7 @@ public class E2E_Print { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Print.java", "Print"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Print.java", "Print"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Return.java b/src/test/java/E2ETests/Features/E2E_Return.java index 31e6b88..c04cda2 100644 --- a/src/test/java/E2ETests/Features/E2E_Return.java +++ b/src/test/java/E2ETests/Features/E2E_Return.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'Return' at src/test/testFiles/E2EFeatures/Return.java was successful, @@ -14,7 +14,7 @@ public class E2E_Return { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Return { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Return.java", "Return"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Return.java", "Return"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_Unary.java b/src/test/java/E2ETests/Features/E2E_Unary.java index 5515598..2686cda 100644 --- a/src/test/java/E2ETests/Features/E2E_Unary.java +++ b/src/test/java/E2ETests/Features/E2E_Unary.java @@ -1,6 +1,6 @@ package E2ETests.Features; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class E2E_Unary { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_Unary { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Unary.java", "Unary"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Unary.java", "Unary"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/Features/E2E_VariableDefWithDecl.java b/src/test/java/E2ETests/Features/E2E_VariableDefWithDecl.java index b2b74d1..5b01665 100644 --- a/src/test/java/E2ETests/Features/E2E_VariableDefWithDecl.java +++ b/src/test/java/E2ETests/Features/E2E_VariableDefWithDecl.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'VariableDefWithDecl' at src/test/testFiles/E2EFeatures/VariableDefWithDecl.java was successful, @@ -14,7 +14,7 @@ public class E2E_VariableDefWithDecl { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_VariableDefWithDecl { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/VariableDefWithDecl.java", + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/VariableDefWithDecl.java", "VariableDefWithDecl"); } catch (Exception e) { throw new RuntimeException(e); diff --git a/src/test/java/E2ETests/Features/E2E_While.java b/src/test/java/E2ETests/Features/E2E_While.java index 18735b1..5044ec9 100644 --- a/src/test/java/E2ETests/Features/E2E_While.java +++ b/src/test/java/E2ETests/Features/E2E_While.java @@ -3,7 +3,7 @@ package E2ETests.Features; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import E2ETests.BytecodeTestUtil; +import E2ETests.ReflectionsTestUtil; /** * Test class for testing if the compilation of the class 'While' at src/test/testFiles/E2EFeatures/While.java was successful, @@ -14,7 +14,7 @@ public class E2E_While { /** * The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class */ - private BytecodeTestUtil util; + private ReflectionsTestUtil util; /** * Initializes the BytecodeTestUtil instance for the test class @@ -22,7 +22,7 @@ public class E2E_While { @BeforeEach public void setUp() { try { - util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/While.java", "While"); + util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/While.java", "While"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/test/java/E2ETests/BytecodeTestUtil.java b/src/test/java/E2ETests/ReflectionsTestUtil.java similarity index 97% rename from src/test/java/E2ETests/BytecodeTestUtil.java rename to src/test/java/E2ETests/ReflectionsTestUtil.java index ced1ee8..ba051d7 100644 --- a/src/test/java/E2ETests/BytecodeTestUtil.java +++ b/src/test/java/E2ETests/ReflectionsTestUtil.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -public class BytecodeTestUtil { +public class ReflectionsTestUtil { /** * Class object representing the class that was compiled and can be analysed using reflection @@ -24,7 +24,7 @@ public class BytecodeTestUtil { /** * Logger to log exceptions */ - private static final Logger LOGGER = Logger.getLogger(BytecodeTestUtil.class.getName()); + private static final Logger LOGGER = Logger.getLogger(ReflectionsTestUtil.class.getName()); /** * Constructor to compile the source files, load the Class-Object and create an instance of the class @@ -32,7 +32,7 @@ public class BytecodeTestUtil { * @param className Name of the class to be loaded into the Class-Object and create an instance of * @throws Exception If any exception occurs */ - public BytecodeTestUtil(String sourceFilePath, String className) throws Exception { + public ReflectionsTestUtil(String sourceFilePath, String className) throws Exception { // Generate bytecode from source file byte[] resultBytecode = Compiler.generateByteCodeArrayFromFiles(List.of(sourceFilePath)).get(0);