Code example:
@RunWIth(RobolectricTestRunner.class)
public class MyTest{
public final android.content.Intent intent = android.content.Intent.parse("http://www.gradle.com");
@Test
public void someTest(){
......
}
}
The RobolectricTestRunner class hooks into all the android.* and com.android.* packages and redirects them to its own implementations. Currently the test is failing when loading the class, as Intent.parse has no implementation in the standard Android SDK.
In Maven / IntelliJ the JUnit Executor loads the Class<?> variable pointing to MyClass.class first with “false” so that it can then setup the RunWith Runner before anything is attempted to be initialized in the test class (MyTest).
In the Above example it is currently impossible for the Runner to do anything with member variables before the JUnitTestClassExecuter loads them.