Open ebi-igweze opened 5 years ago
@ebi-igweze this won't solve the problem, but may be a better workaround: try function-local functions, if they work you can at least keep those functions close to usage and maybe even access local variables.
This is also an issue in Java 8. Wrapping lambdas in getters works around the problem, but it looks to be at least related to this, if not actually being the same issue. I've had to work around this 3 or so times at work in the last 6 months, and it originally took me about 7 hours of debugging to figure out that this is actually the cause.
When running with PowerMockito 2, files with lambda expressions fail to parse and I get the following error
java.lang.IllegalStateException: Failed to transform class with name com.example.domain.CaseTest. Reason: [source error] ) is missing
It produces the error when you try using lambda expression like the ones defined above. I have to use the following work around, what I had to do was create a member function for the test and pass it as a parameter. For instance