From 1ce180ce745a80d22b29009019f487a107fb4b6e Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Tue, 24 Jan 2023 11:55:40 +0100 Subject: [PATCH] Change tests to umatch updated generics --- src/test/java/targetast/TestComplete.java | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/test/java/targetast/TestComplete.java b/src/test/java/targetast/TestComplete.java index a12441c2..b2f38f77 100644 --- a/src/test/java/targetast/TestComplete.java +++ b/src/test/java/targetast/TestComplete.java @@ -1,6 +1,7 @@ package targetast; import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.Ignore; import org.junit.Test; import java.lang.reflect.Method; @@ -381,13 +382,14 @@ public class TestComplete { var instance = tph3.getDeclaredConstructor().newInstance(); var m1 = tph3.getDeclaredMethod("m1", Object.class, Object.class); - // public void m1(DZC var1, DZC var2) + // public void m1(DXBD var1, DXBE var2) var paraTypes = m1.getGenericParameterTypes(); var typeParaTypes = m1.getTypeParameters(); - var DZC = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); - assertEquals(DZC, Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get()); - assertEquals(Object.class, DZC.getBounds()[0]); + var DXBD = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + assertEquals(Object.class, DXBD.getBounds()[0]); + var DXBE = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); + assertEquals(DXBD, DXBE.getBounds()[0]); var m2 = tph3.getDeclaredMethod("m2", Object.class); @@ -406,18 +408,17 @@ public class TestComplete { var instance = tph4.getDeclaredConstructor().newInstance(); var m = tph4.getDeclaredMethod("m", Object.class, Object.class); - // public M m(N var1, O var2) + // public N m(O var1, P var2) var paraTypes = m.getGenericParameterTypes(); var typeParaTypes = m.getTypeParameters(); - var N = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + var N = Arrays.stream(typeParaTypes).filter(t -> t.equals(m.getGenericReturnType())).findFirst().get(); assertEquals(Object.class, N.getBounds()[0]); - var O = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); - var P = Arrays.stream(typeParaTypes).filter(t -> t.equals(O.getBounds()[0])).findFirst().get(); - var M = Arrays.stream(typeParaTypes).filter(t -> t.equals(P.getBounds()[0])).findFirst().get(); - assertEquals(Object.class, M.getBounds()[0]); - assertEquals(M, m.getGenericReturnType()); + var O = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + var P = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); + assertEquals(N, P.getBounds()[0]); + assertEquals(O.getBounds()[0], Object.class); var m2 = tph4.getDeclaredMethod("m2", Object.class);