Created
April 5, 2012 00:28
-
-
Save avh4/2306799 to your computer and use it in GitHub Desktop.
Robolectric Test Runner that sets up custom shadows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.xtremelabs.robolectric.Robolectric; | |
import com.xtremelabs.robolectric.RobolectricTestRunner; | |
public class MyTestRunner extends RobolectricTestRunner { | |
public MyTestRunner(Class<?> testClass) throws InitializationError { | |
super(testClass); | |
addClassOrPackageToInstrument("com.package.ClassToShadow"); | |
} | |
@Override | |
protected void bindShadowClasses() { | |
super.bindShadowClasses(); | |
Robolectric.bindShadowClass(ShadowClassToShadow.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment