Kleiner Hack für Inherit test

This commit is contained in:
JanUlrich 2020-05-08 11:26:07 +02:00
parent 8e2d4e1c70
commit 60b182b9b1
3 changed files with 5 additions and 3 deletions

View File

@ -75,7 +75,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
</goals> </goals>
<configuration> <configuration>
<sourceDirectory>src/main/antlr4/java8</sourceDirectory> <sourceDirectory>src/main/antlr4/java8</sourceDirectory>
<outputDirectory>${project.basedir}/target/generated-sources/antlr4/de/dhbwstuttgart/parser/antlr</outputDirectory> <outputDirectory>${project.basedir}/src/main/java/de/dhbwstuttgart/parser/antlr</outputDirectory>
<arguments> <arguments>
<argument>-package</argument> <argument>-package</argument>
<argument>de.dhbwstuttgart.parser.antlr</argument> <argument>de.dhbwstuttgart.parser.antlr</argument>
@ -89,7 +89,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
</goals> </goals>
<configuration> <configuration>
<sourceDirectory>src/main/antlr4/sat</sourceDirectory> <sourceDirectory>src/main/antlr4/sat</sourceDirectory>
<outputDirectory>${project.basedir}/target/generated-sources/antlr4/de/dhbwstuttgart/sat/asp/parser/antlr</outputDirectory> <outputDirectory>${project.basedir}/src/main/java/de/dhbwstuttgart/sat/asp/parser/antlr</outputDirectory>
<arguments> <arguments>
<argument>-package</argument> <argument>-package</argument>
<argument>de.dhbwstuttgart.sat.asp.parser.antlr</argument> <argument>de.dhbwstuttgart.sat.asp.parser.antlr</argument>

View File

@ -138,11 +138,12 @@ public class InheritTest {
*/ */
@Test @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)}); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("Inherit"); classToTest = loader.loadClass("Inherit");
Method m = classToTestAA.getDeclaredMethod("m", Integer.class); Method m = classToTestAA.getDeclaredMethod("m", Integer.class);
assertEquals(m.invoke(instanceOfClassAA, 5), "AA"); assertEquals(m.invoke(instanceOfClassAA, 5), "AA");
classToTestAA = classToTest.getField("aafield").getType();
Method main = classToTest.getDeclaredMethod("main", classToTestAA, Integer.class); Method main = classToTest.getDeclaredMethod("main", classToTestAA, Integer.class);
assertEquals(main.invoke(instanceOfClass, instanceOfClassAA, 5), "AA"); assertEquals(main.invoke(instanceOfClass, instanceOfClassAA, 5), "AA");
} }

View File

@ -6,6 +6,7 @@ import java.lang.String;
public class Inherit { public class Inherit {
AA aafield;
//m(Integer i) { return "AA"; } //m(Integer i) { return "AA"; }
main(d, i) { main(d, i) {