title: How to use intent when testing Android classes?
body: <p>here is some sample code, it seems that it doesn't work for me.</p>
  
  <pre><code>public class CropImageTest extends ActivityInstrumentationTestCase2&lt;CropImage&gt; {
  
      private Instrumentation mInstrumentation;
      private CropImage mActivity;
      private String filename = "/mnt/sdcard/DCIM/Camera/2011-05-12 09.22.56.jpg";
      private int aspectX = 1;
      private int aspectY = 1;
      private boolean scale = true;
  
      public CropImageTest() {
          super("hk.com.novare.android.cropimage", CropImage.class);
      }
  
      @Override
      protected void setUp() throws Exception {
          super.setUp();
          this.mInstrumentation = getInstrumentation();
          Intent i = new Intent(mInstrumentation.getContext(), CropImage.class);
  
          i.putExtra("image-path", filename);
          i.putExtra("aspectY", aspectY);
          i.putExtra("aspectX", aspectX);
          i.putExtra("scale", scale);
          setActivityIntent(i);
          mActivity = this.getActivity();  
      }
  
      public void testExtras() {
          String str = "";
          str = mActivity.getIntent().getStringExtra("image-path");
          assertEquals(filename, str);
      }
  }
  </code></pre>
  
  <p>error encountered:</p>
  
  <blockquote>
    <p>Unable to resolve activity for: Intent ( has Extras )</p>
  </blockquote>
  
  <p>my manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
            android:versionCode="1"
            android:versionName="1.0"
            package="hk.com.novare.android.cropimage.tests"&gt;
  
      &lt;uses-sdk android:minSdkVersion="8"/&gt;
      &lt;instrumentation
              android:targetPackage="hk.com.novare.android.cropimage"
              android:name="android.test.InstrumentationTestRunner"/&gt;
      &lt;application
              android:icon="@drawable/icon"
              android:label="@string/app_name"&gt;
          &lt;uses-library android:name="android.test.runner"/&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I encountered the error above even if I set the constructor -> super's string(a package ) same as the one that I've indicated within this test project's manifest.xml.
  please help me.</p>