From 60b182b9b1578f5d0041831c4d48db7c3a6074c4 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 8 May 2020 11:26:07 +0200 Subject: [PATCH] =?UTF-8?q?Kleiner=20Hack=20f=C3=BCr=20Inherit=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- src/test/java/bytecode/InheritTest.java | 3 ++- src/test/resources/bytecode/javFiles/Inherit.jav | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ef0f4502d..833b42704 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ http://maven.apache.org/maven-v4_0_0.xsd"> src/main/antlr4/java8 - ${project.basedir}/target/generated-sources/antlr4/de/dhbwstuttgart/parser/antlr + ${project.basedir}/src/main/java/de/dhbwstuttgart/parser/antlr -package de.dhbwstuttgart.parser.antlr @@ -89,7 +89,7 @@ http://maven.apache.org/maven-v4_0_0.xsd"> src/main/antlr4/sat - ${project.basedir}/target/generated-sources/antlr4/de/dhbwstuttgart/sat/asp/parser/antlr + ${project.basedir}/src/main/java/de/dhbwstuttgart/sat/asp/parser/antlr -package de.dhbwstuttgart.sat.asp.parser.antlr diff --git a/src/test/java/bytecode/InheritTest.java b/src/test/java/bytecode/InheritTest.java index 86181bf6d..77fcb9a17 100644 --- a/src/test/java/bytecode/InheritTest.java +++ b/src/test/java/bytecode/InheritTest.java @@ -138,11 +138,12 @@ public class InheritTest { */ @Test - public void testmainAA() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, MalformedURLException, ClassNotFoundException { + public void testmainAA() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, MalformedURLException, ClassNotFoundException, NoSuchFieldException { loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass("Inherit"); Method m = classToTestAA.getDeclaredMethod("m", Integer.class); assertEquals(m.invoke(instanceOfClassAA, 5), "AA"); + classToTestAA = classToTest.getField("aafield").getType(); Method main = classToTest.getDeclaredMethod("main", classToTestAA, Integer.class); assertEquals(main.invoke(instanceOfClass, instanceOfClassAA, 5), "AA"); } diff --git a/src/test/resources/bytecode/javFiles/Inherit.jav b/src/test/resources/bytecode/javFiles/Inherit.jav index 0ef9c0201..0dd5ddcc1 100644 --- a/src/test/resources/bytecode/javFiles/Inherit.jav +++ b/src/test/resources/bytecode/javFiles/Inherit.jav @@ -6,6 +6,7 @@ import java.lang.String; public class Inherit { +AA aafield; //m(Integer i) { return "AA"; } main(d, i) {