From cd2f030ac6f5b0ec7eaca3d5f6eba42fd275afca Mon Sep 17 00:00:00 2001 From: Till Schnell Date: Wed, 14 Apr 2021 10:50:01 +0200 Subject: [PATCH] remove unused testcase --- .../java/inferWildcards/TestClass1Test.java | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/test/java/inferWildcards/TestClass1Test.java diff --git a/src/test/java/inferWildcards/TestClass1Test.java b/src/test/java/inferWildcards/TestClass1Test.java deleted file mode 100644 index 0f54b571..00000000 --- a/src/test/java/inferWildcards/TestClass1Test.java +++ /dev/null @@ -1,55 +0,0 @@ -package inferWildcards; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; - -import de.dhbwstuttgart.core.JavaTXCompiler; - -public class TestClass1Test { - private static String path; - private static File fileToTest; - private static JavaTXCompiler compiler; - private static ClassLoader loader; - private static Class classToTest; - private static String pathToClassFile; - private static Object instanceOfClass; - - public void generateBC() throws Exception { - String resourcePath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards"; - path = resourcePath + "/TestClass1.java"; - fileToTest = new File(path); - compiler = new JavaTXCompiler(fileToTest); - compiler.generateBytecode(resourcePath + "/generatedBC/"); - pathToClassFile = resourcePath + "/generatedBC/"; - loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); - classToTest = loader.loadClass("TestClass1"); - classToTest.getConstructors(); // this will fail - instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); - - Method getFact = classToTest.getDeclaredMethod("test", Integer.class); -// Field fact = classToTest.getDeclaredField("fact"); -// Class lambda = m.invoke(instanceOfClass).getClass(); -// Class lambda = fact.getType(); -// System.out.println(fact.getType().getName()); -// Method apply = lambda.getMethod("apply", Object.class); -// System.out.println(lambda.getMethods()[0]); -// System.out.println(instanceOfClass.toString()); -// // Damit man auf die Methode zugreifen kann -// apply.setAccessible(true); - // Field value -// Object fieldVal = fact.get(instanceOfClass); - Integer i = 3; -// Method applyFromField = fieldVal.getClass().getDeclaredMethod("apply", Object.class); -// applyFromField.setAccessible(true); -// Integer result = (Integer) apply.invoke(lambda,i); - Integer result = (Integer) getFact.invoke(instanceOfClass,i); - System.out.println(result); - assertEquals(new Integer(3), result); - } - - -}