Created
May 29, 2015 10:40
-
-
Save kmdupr33/fda1634fab637941d338 to your computer and use it in GitHub Desktop.
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 LaunchActivityTest | |
extends ActivityUnitTestCase<LaunchActivity> { | |
... | |
@Override | |
protected void setUp() throws Exception { | |
super.setUp(); | |
mLaunchIntent = new Intent(getInstrumentation() | |
.getTargetContext(), LaunchActivity.class); | |
startActivity(mLaunchIntent, null, null); | |
final Button launchNextButton = | |
(Button) getActivity() | |
.findViewById(R.id.launch_next_activity_button); | |
} | |
@MediumTest | |
public void testNextActivityWasLaunchedWithIntent() { | |
startActivity(mLaunchIntent, null, null); | |
final Button launchNextButton = | |
(Button) getActivity() | |
.findViewById(R.id.launch_next_activity_button); | |
launchNextButton.performClick(); | |
final Intent launchIntent = getStartedActivityIntent(); | |
assertNotNull("Intent was null", launchIntent); | |
assertTrue(isFinishCalled()); | |
final String payload = | |
launchIntent.getStringExtra(NextActivity.EXTRAS_PAYLOAD_KEY); | |
assertEquals("Payload is empty", LaunchActivity.STRING_PAYLOAD, payload); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment