Why are Robolectric involved when specifying @RunWith(AndroidJUnit4::class) as my testrunner?

Viewed 121
    private static String getRunnerClassName() {
    String runnerClassName = System.getProperty("android.junit.runner", null);
    if (runnerClassName == null) {
      // TODO: remove this logic when nitrogen is hooked up to always pass this property
      if (System.getProperty("java.runtime.name").toLowerCase().contains("android")) {
        return "androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner";
      } else {
        return "org.robolectric.RobolectricTestRunner";
      }
    }
    return runnerClassName;
  }

The above code is taken from the AndroidJUnit class, and tells me that it android.junit.runner is not specified and java.runtime.name does not contain 'android' it defaults to Robolectric.

It should not matter, but my tests are written in Kotlin.

Please tell me where or how to specify android.junit.runner (thought the annotation did this) or java.runtime.name?

Thanks, Ove

0 Answers
Related