What is causing "exception in phase 'instruction selection' " in Groovy / Grails unit test?
My best approach thus far has been to iteratively comment things out until the code compiles. A grails clean
does not fix the issue.
Using this process I've found that the problem is my @TestFor(Class)
annotation. I had moved some code from a service to a class in src/groovy. This appears to have caused the annotation to break. I don't really understand why specifically this breaks, but that was sufficient for me to get things working.
So try removing the @TestFor()
annotation if your class under test is not a service or controller or similar.
If that doesn't work, comment everything out and add back one piece at a time.