title: Android Espresso Intent
body: <p>My test file looks like this:</p>
  
  <pre><code>@RunWith(AndroidJUnit4.class)
  @LargeTest
  public class CreateNewSessionActivityTest {
      @Rule
      public IntentsTestRule&lt;CreateNewSessionActivity&gt; mActivityRule = new IntentsTestRule&lt;&gt;(CreateNewSessionActivity.class);
  
      @Test
      public void test() {
          final Intent intent = new Intent();
          intent.setAction(Intent.ACTION_SEND);
          intent.setType("text/plain");
          intent.putExtra(Intent.EXTRA_TEXT, "this is my auth token");
  
          final Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
  
          intending(hasComponent(hasShortClassName(".CreateNewSessionActivity"))).respondWith(result);
  
          onView(withId(R.id.create_new_session_auth_token_edit_text)).check(matches(isDisplayed()));
          onView(withId(R.id.create_new_session_auth_token_edit_text)).check(matches(withText("this is my auth token")));
      }
  }
  </code></pre>
  
  <p>In the <code>CreateNewSessionActivity.onCreate</code> method I execute the following: </p>
  
  <pre><code>final Intent intent = this.getIntent();
  
  if (intent != null) {
      final String action = intent.getAction();
      final String type = intent.getType();
  
      if (Intent.ACTION_SEND.equals(action) &amp;&amp; type != null) {
          if ("text/plain".equals(type)) {
              final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
  
              if (sharedText != null) {
                  authTokenEditText.setText(sharedText);
              }
          }
      }
  }
  </code></pre>
  
  <p>I also registered the Intent Filter in the Manifest underneath the activity.</p>
  
  <pre><code>&lt;intent-filter&gt;
      &lt;action android:name="android.intent.action.SEND"/&gt;
      &lt;category android:name="android.intent.category.DEFAULT"/&gt;
      &lt;data android:mimeType="text/plain"/&gt;
  &lt;/intent-filter&gt;
  </code></pre>
  
  <p>The code in the activity also does work. If I use any app and share text to it it'll be displayed in the EditText.</p>
  
  <p>However this line fails in the test:</p>
  
  <pre><code>onView(withId(R.id.create_new_session_auth_token_edit_text)).check(matches(withText("this is my auth token")));
  </code></pre>
  
  <p>The text won't be displayed in the EditText at all. Is there anything wrong with the way I want to test the Intent?</p>