I have a project in Android Studio which only has a single non-android, pure java module. This module contains a class which I put under test.
The test is executed properly if I manually call gradle build or gradle test.
But if I run it from the IDE ("Run 'All tests'"), the module is not rebuild, it is run on old compiled code. Only when I rebuild it manually with e.g. gradle compileTestJava the code is recompiled and tests are executed properly.
It seems similar to this problem: Android Studio doesn't compile test classes for Java library modules during Make Project