@Before
    public void stubAllExternalIntents() {
        // By default Espresso Intents does not stub any Intents. Stubbing needs to be setup before
        // every test run. In this case all external Intents will be blocked.
        intending(not(isInternal())).respondWith(new ActivityResult(Activity.RESULT_OK, null));
    }
A JUnit {@link Rule @Rule} to init and release Espresso Intents before and after each
test run.
<p>
Rules are interceptors which are executed for each test method and will run before
any of your setup code in the {@link Before @Before} method.
<p>
This rule is based on {@link ActivityTestRule} and will create and launch the activity
for you and also expose the activity under test.
ui/espresso/IntentsBasicSample/app/src/sharedTest/java/com/example/android/testing/espresso/IntentsBasicSample/DialerActivityTest.java