Last active
February 15, 2017 15:20
-
-
Save jabKnowsNothing/27006d96564386929248 to your computer and use it in GitHub Desktop.
ActivityTestRule launchActivity=false
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
@RunWith(AndroidJUnit4.class) | |
public class MultipleIntentsTest { | |
@Rule | |
public ActivityTestRule<MyActivity> testRule = new ActivityTestRule<>(MyActivity.class, | |
false, // initialTouchMode | |
false); // launchActivity. False to set intent per test); | |
@Test | |
public void testOscarGrouchy() { | |
Intent grouchyIntent = new Intent(); | |
// intent stuff | |
grouchyIntent.putExtra("EXTRA_IS_GROUCHY", true); | |
testRule.launchActivity(grouchyIntent); | |
// verify Oscar is grouchy | |
} | |
@Test | |
public void testOscarNotGrouchy() { | |
Intent happyIntent = new Intent(); | |
// intent stuff | |
happyIntent.putExtra("EXTRA_IS_GROUCHY", false); | |
testRule.launchActivity(happyIntent); | |
// verify Oscar is not grouchy | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment