Mysterious Problem with JUnit in IntelliJ IDEA – with Mysterious Fix!

Coming back to work after the holidays, I dutifully fired up my favourite IDE to get to work. Full of energy and determination, I added a lot of code, and felt quite good about myself. The only thing left was running the unit tests, to verify that I had not broken anything.
The tests completed fast; too fast. Looking closer, the only output was “Process finished with exit code 0”, and in fact no tests had been run. I tried it a few more times, but still nothing. Even after uninstalling IntelliJ, rebooting, and reinstalling a fresh copy of the IDE; still the same (non)result mocking me “Process finished with exit code 0”.

Completely stumped, I threw in my towel and searched the internet. Usually, I’m less than impressed with answers on, but in this case there was actually a hint at the solution!

arcane knowledgeApparently, there is something wrong with some cache somewhere. By going to the File menu and selecting “Invalidate Caches / Restart …”, testing should start working again.
And, as if by magic, it did! Right-clicking a package and selecting “Run Tests in …” started correctly, and lights started showing up beside each test-case. And they where all green. And it was good.

I still don’t understand what was wrong, and what I did to fix it, but now I at least have added another tool to my arsenal of arcane knowledge.

The referenced question at Stack Overflow can be found here: