title: How do I test for ACTION_TAG_DISCOVERED?
body: <p>I have an Android activity that when in contact with an NFC tag calls a certain function. I would like to create tests for that. </p>
  
  <p>In my test file, my logic is as follows:</p>
  
  <pre><code>// Create a ACTION_TAG_DISCOVERED
  // Respond to ACTION_TAG_DISCOVERED
  public void testNfc(){
  
  }
  </code></pre>
  
  <p>In my code, I have a callback function "onNewIntent" which looks at the intent created when in proximity to an NFC tag:</p>
  
  <pre><code>protected void onNewIntent(Intent intent) {
      if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { ... }
  </code></pre>
  
  <p>But, in my test code, I cannot create an Intent of ACTION_TAG_DISCOVERED. I looked at the class <a href="http://developer.android.com/reference/android/content/Intent.html" rel="nofollow">here</a>.</p>
  
  <p>How do I create an <code>ACTION_TAG_DISCOVERED</code> intent so I can test it? Somewhere along this line:</p>
  
  <pre><code>Intent nfcIntent = new Intent(Intent.ACTION_TAG_DISCOVERED)
  if(nfcIntent == ACTION_TAG_DISCOVERED)
  assertSomeMethod("functionWhichHandlesNFCTagDiscovered")
  </code></pre>
  
  <p>Thanks much!</p>