-
-
Save jabKnowsNothing/8a5ff1a96be867ad5979 to your computer and use it in GitHub Desktop.
Custom Rule For Espresso Blog bost
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
public class MyCustomRule<A extends MyActivity> extends ActivityTestRule<A> { | |
public MyCustomRule(Class<A> activityClass) { | |
super(activityClass); | |
} | |
@Override | |
protected void beforeActivityLaunched() { | |
super.beforeActivityLaunched(); | |
// Maybe prepare some mock service calls | |
// Maybe override some depency injection modules with mocks | |
} | |
@Override | |
protected Intent getActivityIntent() { | |
Intent customIntent = new Intent(); | |
// add some custom extras and stuff | |
return customIntent; | |
} | |
@Override | |
protected void afterActivityLaunched() { | |
super.afterActivityLaunched(); | |
// maybe you want to do something here | |
} | |
@Override | |
protected void afterActivityFinished() { | |
super.afterActivityFinshed(); | |
// Clean up mocks | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment