title: Robolectric testing activity creation including intent extras
body: <p>I have an activity that will grab a pojo from the extras, like so :</p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          Bundle extras = getIntent().getExtras();
          if (extras != null)
          {
              MyPojo pojo = extras.getParcelable("pojo");
              // do stuff with my pojo here
              }
          }
          // button that shows a toast message
      }
  </code></pre>
  
  <p>I'm having difficulty being able to test this using Robolectric, I believe I need to use a combination of ShadowIntents and ShadowActivities, but the documentation is a little thin, and any useful tutorials on this particular scenario are rather sparse.</p>
  
  <p>This is what I've come up with so far :</p>
  
  <pre><code>@Test
      public void assertClickingTagSightingDisplaysToast()
      {
          myActivity = new MyActivity();
          myActivity.onCreate(null);
          ShadowActivity shadowMyActivity = shadowOf(myActivity);
          shadowMyActivity.setIntent(new Intent().putExtra("pojo", generateAPojo()));
  
  
          ShadowButton shadowButton = (ShadowButton) shadowOf(shadowMyActivity.findViewById(R.id.myButton));
          shadowButton.performClick();
  
          assertThat(ShadowToast.getTextOfLatestToast(), equalTo("Button was clicked!"));
      }
  </code></pre>
  
  <p>I keep getting a null pointer when I execute these tests, at the <code>getIntent().getExtras()</code> line of my activity, I'm assuming that my process of mocking the activities with intents is incorrect.</p>
  
  <p>can anyone please help?</p>
  
  <p>Thanks</p>