modified: ../../test/bytecode/LambdaTest.java

Lambda-Ausruck wird ausgewertet. Funktioniert nicht, vermutich, weil Lambda-Methode apply private
This commit is contained in:
Martin Plümicke 2018-07-18 17:54:44 +02:00
parent c3ca4777bb
commit fe99db81b3

View File

@ -33,11 +33,10 @@ public class LambdaTest {
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
Method m = classToTest.getDeclaredMethod("m");
//Class<?>
Object lambda = (m.invoke(instanceOfClass)); //.getClass();
//Method apply = lambda.getMethod("apply", Integer.class);
//Integer result = (Integer) apply.invoke(lambda, 77);
//assertEquals(77, result);
Class<?> lambda = m.invoke(instanceOfClass).getClass();
Method apply = lambda.getMethod("apply", Object.class);
Integer result = (Integer) apply.invoke(lambda, new Integer(77)); //laeuft nicht, vermutlich weil Lambda-Ausdruck private
assertEquals(77, result);
}