Java Code Examples for android.support.test.espresso.intent.Intents

The following are top voted examples for showing how to use android.support.test.espresso.intent.Intents. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: StartupTest.java   View source code 6 votes vote down vote up
private void startNewLocalConnection(String name) {
	onView(withId(R.id.add_host_button)).perform(click());
	onView(withId(R.id.protocol_text)).perform(click());
	onView(withText("local")).perform(click());
	onView(withId(R.id.quickconnect_field)).perform(typeText(name));
	onView(withId(R.id.save)).perform(click());

	Intents.init();
	try {
		onView(withId(R.id.list)).perform(actionOnHolderItem(
				withHostNickname(name), click()));
		intended(hasComponent(ConsoleActivity.class.getName()));
	} finally {
		Intents.release();
	}

	onView(withId(R.id.console_flip)).check(matches(
			hasDescendant(allOf(isDisplayed(), withId(R.id.terminal_view)))));
}
 
Example 2
Project: polling-station-app   File: ElectionChoiceActivityTest.java   View source code 6 votes vote down vote up
@Before
public void setUp() {
    Intents.init();

    // Wait till the splashactivity is closed, indicating blockchain was instantiated has started
    Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mActivityRule.launchActivity(new Intent(targetContext, ElectionChoiceActivity.class));
    while (!mActivityRule.getActivity().isFinishing()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    activity = (ElectionChoiceActivity) mElectionActivityRule.launchActivity(new Intent(targetContext, ElectionChoiceActivity.class));
}
 
Example 3
Project: polling-station-app   File: TestResultActivity.java   View source code 6 votes vote down vote up
@Before
public void setUp() {
    Intents.init();

    // Wait till the splashactivity is closed, indicating blockchain was instantiated has started
    Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    splashActivityRule.launchActivity(new Intent(targetContext, SplashActivity.class));
    while (!splashActivityRule.getActivity().isFinishing()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    Context targetContext2 = InstrumentationRegistry.getInstrumentation()
            .getTargetContext();
    Intent intent = new Intent(targetContext2, ResultActivity.class);
    intent.putExtra("pubKey", pubKey);
    intent.putExtra("voter", voter);
    resultActivity = (ResultActivity) activityRule.launchActivity(intent);
}
 
Example 4
Project: polling-station-app   File: TestElectionChoice.java   View source code 6 votes vote down vote up
@Before
public void setUp() {
    Intents.init();

    // Wait till the splashactivity is closed, indicating blockchain was instantiated has started
    Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mActivityRule.launchActivity(new Intent(targetContext, SplashActivity.class));
    while (!mActivityRule.getActivity().isFinishing()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    electionActivity = (ElectionChoiceActivity) mElectionActivityRule.launchActivity(new Intent(targetContext, ElectionChoiceActivity.class));
}
 
Example 5
Project: smart-lens   File: IntentTestUtils.java   View source code 6 votes vote down vote up
/**
 * Check if the activity is changed when any view is clicked.
 *
 * @param context          instance of the caller.
 * @param viewId           id of the view.
 * @param nextActivityName Name of the next activity.
 */
public static void checkActivityOnViewClicked(Context context,
                                              int viewId,
                                              String nextActivityName) {
    Intents.init();

    //set intent package
    intending(toPackage(context.getString(R.string.package_name)));

    // Perform click operation on FAB
    onView(withId(viewId)).perform(click());

    // Assert that if the opened activity is Quiz activity.
    intended(hasComponent(nextActivityName));

    Intents.release();
}
 
Example 6
Project: AndroidTestingTutorial   File: GalleryPickerTesting.java   View source code 6 votes vote down vote up
@Test
public void checkTextOnScreen() {
    //to check view on screen

    Intent resultData = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    resultData.setData(Uri.parse(("content://media/external/images/media/337663")));
    Matcher<Intent> MediaPickIntent = allOf(hasAction(Intent.ACTION_PICK), hasData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
    Intents.init();
    intending(MediaPickIntent).respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));

    onView(withText("Gallery")).perform(click());
    onView(withId(R.id.btnGalleryPick)).perform(click());
    intended(MediaPickIntent);
    //To check the image pick works or not
    try{
        Thread.sleep(4500);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
 
Example 7
Project: android-keep-testing   File: HomeActivityTest.java   View source code 6 votes vote down vote up
@Test
public void shouldLoadUsersAndTriggerIntent() {
    serverRule
            .enqueueGET(200, "users.json")
            .assertPathIs("/2.2/users")
            .assertHasQuery("order", "desc")
            .assertHasQuery("sort", "reputation")
            .assertHasQuery("site", "stackoverflow");

    Intents.init();
    activityRule.launchActivity(new Intent(Intent.ACTION_MAIN));

    onView(withId(R.id.recyclerView))
            .perform(scrollToPosition(3));

    TestUtils.rotateScreen(activityRule);

    onView(withId(R.id.recyclerView))
            .perform(actionOnItemAtPosition(2, click()));

    intended(allOf(
            hasAction(Intent.ACTION_VIEW),
            hasData(Uri.parse("http://stackoverflow.com/users/157882/balusc"))
    ));
    Intents.release();
}
 
Example 8
Project: android-keep-testing   File: HomeActivityMockTest.java   View source code 6 votes vote down vote up
@Test
public void shouldLoadUsersAndTriggerIntent() {
    when(mockApi.getUsers(anyInt())).thenReturn(successResult());

    Intents.init();
    activityRule.launchActivity(new Intent(Intent.ACTION_MAIN));

    onView(withId(R.id.recyclerView))
            .perform(scrollToPosition(3));

    TestUtils.rotateScreen(activityRule);

    onView(withId(R.id.recyclerView))
            .perform(actionOnItemAtPosition(2, click()));

    intended(allOf(
            hasAction(Intent.ACTION_VIEW),
            hasData(Uri.parse("http://stackoverflow.com/users/157882/balusc"))
    ));
    Intents.release();
}
 
Example 9
Project: android-keep-testing   File: HomeActivityReflectionTest.java   View source code 6 votes vote down vote up
@Test
public void shouldLoadUsersAndTriggerIntent() {
    serverRule
            .enqueueGET(200, "users.json")
            .assertPathIs("/2.2/users")
            .assertHasQuery("order", "desc")
            .assertHasQuery("sort", "reputation")
            .assertHasQuery("site", "stackoverflow");

    Intents.init();
    activityRule.launchActivity(new Intent(Intent.ACTION_MAIN));

    onView(withId(R.id.recyclerView))
            .perform(scrollToPosition(3));

    TestUtils.rotateScreen(activityRule);

    onView(withId(R.id.recyclerView))
            .perform(actionOnItemAtPosition(2, click()));

    intended(allOf(
            hasAction(Intent.ACTION_VIEW),
            hasData(Uri.parse("http://stackoverflow.com/users/157882/balusc"))
    ));
    Intents.release();
}
 
Example 10
Project: todos   File: MainActivityTest.java   View source code 6 votes vote down vote up
public void testTapItem() {
    Intents.init();
    addInitialData();

    pause();

    // DO UI INTERACTION
    onView(withId(R.id.recycler)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click
            ()));

    pause();

    // Confirm that the TodoListActivity was started!
    intended(hasComponent(TodoListActivity.class.getName()));
    Intents.release();
}
 
Example 11
Project: iosched   File: SessionDetailActivity_InScheduleStarredSessionTest.java   View source code 6 votes vote down vote up
@Test
public void speakerImage_WhenClicked_IntentFired() {
    Intent resultData = new Intent();
    resultData.putExtras(new Bundle());

    // Create the ActivityResult with the Intent.
    Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())).respondWith(
            new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));

    // When clicking on speaker image
    onView(withId(R.id.session_detail_frag)).perform(swipeUp());
    onView(withId(R.id.speaker_image)).perform(click());

    // Then the intent to display the speaker url is fired
    Uri expectedSpeakerUri = Uri.parse(SpeakersMockCursor.FAKE_SPEAKER_URL);
    intended(CoreMatchers.allOf(
            hasAction(IsEqual.equalTo(Intent.ACTION_VIEW)),
            hasData(expectedSpeakerUri)));
}
 
Example 12
Project: iosched   File: SessionDetailActivity_EndedLiveStarredSessionTest.java   View source code 6 votes vote down vote up
@Test
public void youTubeVideo_WhenClicked_IntentFired() {
    Intent resultData = new Intent();
    resultData.putExtras(new Bundle());

    // Create the ActivityResult with the Intent.
    Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())).respondWith(
            new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));

    // When clicking on video
    onView(withId(R.id.watch)).perform(click());

    // Then the intent to play the video is fired
    IntentUtils.checkVideoIntentIsFired(SessionsMockCursor.FAKE_YOUTUBE_URL,
            mActivityRule.getActivity(), false);
}
 
Example 13
Project: polling-station-app   File: ElectionChoiceActivityTest.java   View source code 5 votes vote down vote up
@After
public void destroy() {
    Intents.release();
    try {
        BlockChain.getInstance(null).disconnect();
    } catch (Exception e) {
        e.printStackTrace();
    }
    activity.finish();
}
 
Example 14
Project: polling-station-app   File: TestResultActivity.java   View source code 5 votes vote down vote up
@After
public void destroy() {
    Intents.release();
    try {
        BlockChain.getInstance(null).disconnect();
    } catch (Exception e) {
        e.printStackTrace();
    }
    resultActivity.finish();
}
 
Example 15
Project: polling-station-app   File: TestElectionChoice.java   View source code 5 votes vote down vote up
@After
public void destroy() {
    Intents.release();
    try {
        BlockChain.getInstance(null).disconnect();
    } catch (Exception e) {
        e.printStackTrace();
    }
    electionActivity.finish();
}
 
Example 16
Project: cat-is-a-dog   File: AuthTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Intents.init();

    mIdlingResource = mActivityRule.getActivity().getIdlingResource();
    IdlingRegistry.getInstance().register(mIdlingResource);
}
 
Example 17
Project: cat-is-a-dog   File: AuthTest.java   View source code 5 votes vote down vote up
@After
public void tearDown() {
    Intents.release();

    if (mIdlingResource != null) {
        IdlingRegistry.getInstance().unregister(mIdlingResource);
    }
}
 
Example 18
Project: kheera-testrunner-android   File: LoginPageFeatureFile.java   View source code 5 votes vote down vote up
@OnStartTest()
public void onStartTest(String featureName, String scenarioName) {

    IdlingPolicies.setMasterPolicyTimeout(30, TimeUnit.SECONDS);

    Log.v(runnerConfig.LogTag, "Starting Test: " + featureName + " - " + scenarioName);
    Intents.init();
}
 
Example 19
Project: kheera-testrunner-android   File: LoginPageFeatureFile.java   View source code 5 votes vote down vote up
@OnFinishTest()
public void onFinishTest(String featureName, String scenarioName) {
    getInstrumentation().waitForIdleSync();

    if (LoginScreen.ActivityInstance != null) {

        if (Build.VERSION.SDK_INT > 20) {
            LoginScreen.ActivityInstance.finishAndRemoveTask();
        }
    }

    Intents.release();
}
 
Example 20
Project: Spork   File: ImmediateIntentsTestRule.java   View source code 5 votes vote down vote up
@Override
public Statement apply(final Statement base, Description description) {
	return new Statement() {
		@Override
		public void evaluate() throws Throwable {
			try {
				Intents.init();
				base.evaluate();
			} catch (Exception e) {
				Intents.release();
			}
		}
	};
}
 
Example 21
Project: AndroidArchitecture   File: RepositoriesActivityTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    mContext = InstrumentationRegistry.getContext();
    ApiFactory.setProvider(new IntegrationProviderImpl(new TestServerImpl()));
    Intents.init();
    clearRepositories();
}
 
Example 22
Project: AndroidArchitecture   File: WalkthroughActivityTest.java   View source code 5 votes vote down vote up
@Test
public void testStartsLogInActivity() throws Exception {
    onView(withId(R.id.pager)).perform(swipeLeft());
    onView(withId(R.id.pager)).perform(swipeLeft());
    onView(withId(R.id.btn_walkthrough)).perform(click());

    Intents.intended(hasComponent(LogInActivity.class.getName()));
}
 
Example 23
Project: AndroidArchitecture   File: LogInActivityTest.java   View source code 5 votes vote down vote up
@Test
public void testErrorThenCorrect() throws Exception {
    errorInputAndClick();

    onView(LOGIN_INPUT_LAYOUT).check(matches(withInputError(R.string.error)));

    clearInputs();

    correctInputAndClick();
    Intents.intended(hasComponent(RepositoriesActivity.class.getName()));
}
 
Example 24
Project: quickstart-android   File: MainActivityTest.java   View source code 5 votes vote down vote up
@Before
public void before() {
    // Initialize intents
    Intents.init();

    // Idling resource
    mUploadIdlingResource = new ServiceIdlingResource(mActivityTestRule.getActivity(),
            MyUploadService.class);
    Espresso.registerIdlingResources(mUploadIdlingResource);
}
 
Example 25
Project: quickstart-android   File: MainActivityTest.java   View source code 5 votes vote down vote up
@After
public void after() {
    // Release intents
    Intents.release();

    // Idling resource
    if (mUploadIdlingResource != null) {
        Espresso.unregisterIdlingResources(mUploadIdlingResource);
    }
}
 
Example 26
Project: 2016.2-MissaoNascente   File: MainScreenAcceptanceTest.java   View source code 5 votes vote down vote up
private void createCameraMockup(String qrCode){
    //mockup camera result
    Intent resultData = new Intent();
    resultData.putExtra(com.google.zxing.client.android.Intents.Scan.RESULT, qrCode);
    Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData);
    Matcher<Intent> matcher  = hasAction(com.google.zxing.client.android.Intents.Scan.ACTION);

    OngoingStubbing ongoingStubbing  = intending(matcher);
    ongoingStubbing.respondWith(result);
    //end mockup camera result
}
 
Example 27
Project: RecipeFinderJavaVersion   File: RecipeAnalysisFragmentTest.java   View source code 5 votes vote down vote up
@Test
public void testRecipeAnalysis() {
    when(repository.getRecipeAnalysisData(ArgumentMatchers.<RecipeAnalysisParams>any()))
            .thenReturn(Single.just(AssetUtils.getRecipeAnalysisResult(context)));

    rule.launchActivity(new Intent());

    selectTab();
    inputFields();

    onView(withId(R.id.btn_analyze)).perform(click());
    Intents.intended(IntentMatchers.hasComponent(RecipeAnalysisDetailsActivity.class.getName()));
}
 
Example 28
Project: material-activity-chooser   File: SampleListStepDefinitions.java   View source code 5 votes vote down vote up
@SuppressWarnings("UnusedParameters")
@After
public static void after(Scenario scenario) {
    ActivityUtils.finishOpenActivities();
    Intents.release();
}
 
Example 29
Project: AndroidSchool   File: RepositoriesActivityTest.java   View source code 5 votes vote down vote up
@Test
public void testClickOnItem() throws Exception {
    onView(withId(R.id.recyclerView))
            .perform(actionOnItemAtPosition(14, click()));

    Intents.intended(hasComponent(CommitsActivity.class.getName()));
}
 
Example 30
Project: AndroidSchool   File: RepositoriesActivityTest.java   View source code 5 votes vote down vote up
@After
public void tearDown() throws Exception {
    Intents.release();
    if (idlingResource != null) {
        Espresso.unregisterIdlingResources(idlingResource);
    }
    RepositoryProvider.provideKeyValueStorage().clear();
    Realm.getDefaultInstance().executeTransaction(realm -> realm.deleteAll());
}
 
Example 31
Project: AndroidSchool   File: AuthActivityTest.java   View source code 5 votes vote down vote up
@Test
public void testSuccessAuth() throws Exception {
    onView(withId(R.id.loginEdit)).perform(typeText("login"));
    closeSoftKeyboard();
    onView(withId(R.id.passwordEdit)).perform(typeText("pass"));
    closeSoftKeyboard();
    onView(withId(R.id.logInButton)).perform(click());

    IdlingResource idlingResource = TimeIdlingResource.timeout(4000);
    Intents.intended(hasComponent(RepositoriesActivity.class.getName()));
    Espresso.unregisterIdlingResources(idlingResource);

}
 
Example 32
Project: EDSApp   File: WipeDataOnLogout.java   View source code 5 votes vote down vote up
@Test
public void wipeDataOnLogout(){
    //Given
    Intents.init();

    onView(withId(org.hisp.dhis.android.sdk.R.id.server_url)).perform(replaceText(SDKTestUtils.HNQIS_DEV_CI));
    onView(withId(org.hisp.dhis.android.sdk.R.id.username)).perform(replaceText(SDKTestUtils.TEST_USERNAME_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.password)).perform(replaceText(SDKTestUtils.TEST_PASSWORD_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.login_button)).perform(click());

    intended(hasComponent(ProgressActivity.class.getName()));

    //Waiting for pull to finish in order to clear the state of the app
    waitForPull(DEFAULT_WAIT_FOR_PULL);

    //When
    SDKTestUtils.goToLogin();

    //Then

    //Removed sdk data
    assertTrue(EventExtended.count() == 0);
    assertTrue(DataValueExtended.count() == 0);


    //removed app data
    assertTrue(Survey.count() == 0);
    assertTrue(Value.count() == 0);

    Intents.release();
}
 
Example 33
Project: EDSApp   File: LoginTest.java   View source code 5 votes vote down vote up
@Test
public void loginWithRightCredentials(){
    Intents.init();

    onView(withId(org.hisp.dhis.android.sdk.R.id.server_url)).perform(replaceText(SDKTestUtils.HNQIS_DEV_CI));
    onView(withId(org.hisp.dhis.android.sdk.R.id.username)).perform(replaceText(SDKTestUtils.TEST_USERNAME_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.password)).perform(replaceText(SDKTestUtils.TEST_PASSWORD_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.login_button)).perform(click());

    intended(hasComponent(ProgressActivity.class.getName()));

    //Waiting for pull to finish in order to clear the state of the app
    waitForPull(DEFAULT_WAIT_FOR_PULL);
    Intents.release();
}
 
Example 34
Project: MicroPinner   File: MainDialogParentPinTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() {

    final Intent testIntent =
            new Intent(activityTestRule.getActivity(), MainDialog.class).putExtra(
                    NotificationTools.EXTRA_INTENT, Constants.testPin);

    Intents.init();
    activityTestRule.launchActivity(testIntent);
}
 
Example 35
Project: kaif-android   File: HomeActivityTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() {
  Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
  KaifApplication app = (KaifApplication) instrumentation.getTargetContext()
      .getApplicationContext();
  TestBeans beans = DaggerTestBeans.builder().build();
  app.setBeans(beans);
  beans.inject(this);
  Intents.init();
}
 
Example 36
Project: kaif-android   File: LoginActivityTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() {
  Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
  KaifApplication app = (KaifApplication) instrumentation.getTargetContext()
      .getApplicationContext();
  TestBeans beans = DaggerTestBeans.builder().build();
  app.setBeans(beans);
  beans.inject(this);
  Intents.init();
}
 
Example 37
Project: malariapp   File: WipeDataOnLogout.java   View source code 5 votes vote down vote up
@Test
public void wipeDataOnLogout(){
    //Given
    Intents.init();

    onView(withId(org.hisp.dhis.android.sdk.R.id.server_url)).perform(replaceText(SDKTestUtils.HNQIS_DEV_CI));
    onView(withId(org.hisp.dhis.android.sdk.R.id.username)).perform(replaceText(SDKTestUtils.TEST_USERNAME_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.password)).perform(replaceText(SDKTestUtils.TEST_PASSWORD_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.login_button)).perform(click());

    intended(hasComponent(ProgressActivity.class.getName()));

    //Waiting for pull to finish in order to clear the state of the app
    waitForPull(DEFAULT_WAIT_FOR_PULL);

    //When
    SDKTestUtils.goToLogin();

    //Then

    //Removed sdk data
    assertTrue(EventExtended.count() == 0);
    assertTrue(DataValueExtended.count() == 0);


    //removed app data
    assertTrue(Survey.count() == 0);
    assertTrue(Value.count() == 0);

    Intents.release();
}
 
Example 38
Project: malariapp   File: LoginTest.java   View source code 5 votes vote down vote up
@Test
public void loginWithRightCredentials(){
    Intents.init();

    onView(withId(org.hisp.dhis.android.sdk.R.id.server_url)).perform(replaceText(SDKTestUtils.HNQIS_DEV_CI));
    onView(withId(org.hisp.dhis.android.sdk.R.id.username)).perform(replaceText(SDKTestUtils.TEST_USERNAME_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.password)).perform(replaceText(SDKTestUtils.TEST_PASSWORD_WITH_PERMISSION));
    onView(withId(org.hisp.dhis.android.sdk.R.id.login_button)).perform(click());

    intended(hasComponent(ProgressActivity.class.getName()));

    //Waiting for pull to finish in order to clear the state of the app
    waitForPull(DEFAULT_WAIT_FOR_PULL);
    Intents.release();
}
 
Example 39
Project: espresso-samples   File: MainActivityTest.java   View source code 5 votes vote down vote up
@Test
public void scan() {
  Context context = InstrumentationRegistry.getTargetContext();
  Assume.assumeTrue(MainActivity.isZXingSupported(context));

  final String format = "EAN_13";
  final String result = "9781449328214";

  Intents.init();

  activityRule.launchActivity(null);

  Intent data = new Intent();

  data.putExtra(MainActivity.KEY_SCAN_RESULT_FORMAT, format);
  data.putExtra(MainActivity.KEY_SCAN_RESULT, result);
  Instrumentation.ActivityResult activityResult = new Instrumentation.ActivityResult(
      Activity.RESULT_OK, data);

  intending(hasAction(MainActivity.ACTION_ZXING_SCAN))
      .respondWith(activityResult);

  onView(withId(R.id.scan_button))
      .check(matches(isDisplayed()))
      .perform(click());

  onView(withId(R.id.format))
      .check(matches(withText(format)));
  onView(withId(R.id.result))
      .check(matches(withText(result)));

  Intents.release();
}
 
Example 40
Project: vb-android-app-quality   File: TestMainActivityWithEspresso.java   View source code 5 votes vote down vote up
@Override
public void testThatDefaultBehaviorIsWorking() throws Exception {
    Instrumentation.ActivityResult dummyResult = new Instrumentation.ActivityResult(0, null);
    Intents.intending(allOf(
            hasAction(Intent.ACTION_SEND),
            IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, mActivityRule.getActivity().getString(R.string.share_title))))
            .respondWith(dummyResult);
    super.testThatDefaultBehaviorIsWorking();
}