Problem with Grails Integration Test in IntelliJ IDEA

I tried to test a Grails Service with an Integration Test in my beloved IDEA IDE – sometimes it worked as expected, sometimes the service was not injected and the test failed with a Null Pointer Exception.

It took me a while to figure out that the problem is related to the Run /Debug configuration. When IDEA applies a Run/Debug configuration in which the Integration Test is assigned to the Unit Tests Configuration, the Test is treated exaclty us such and consequently the Service is not injected.

The solution to the problem is therefore to make sure that your Integration Test is running inside the Grails Configuration in IDEA.

Leave a Reply

Your email address will not be published. Required fields are marked *