Skip to content
Advertisement

Testing Java code with Groovy under Intellij: unable to resolve class GroovyTestCase

I need to write a short test for some Java code. I used CTRL+SHIFT+T to generate one with IntelliJ, and selected “Groovy JUnit” as the testing library, then wrote the following test:

JavaScript

However, when I right click on the test case in the project window, I don’t get the “Run All Tests” option that I normally do with JUnit tests, and the compiler throws the following error:

JavaScript

Trying to import GroovyTestCase or FibonacciHeap manually causes the same error. IntelliJ does not add any import statements when I let autocomplete finish the names for me, like it usually would with Java code.

What am I doing wrong?

Advertisement

Answer

This worked for me :

  • Open Gradle window (on right side in my case)
  • Click on refresh button
  • Done

screenshot

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement