title: Android unit test to test if setContentView() is called in onCreate()
body: <p>Have been searching around for a while but cannot find an answer. Let's say I have this activity with onCreate method like this:</p>
  
  <pre><code>private ListView mListView;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main_view);
      mListView = (ListView) findViewById(R.id.list_view);
  }
  </code></pre>
  
  <p>And I have a test class that extends ActivityInstrumentationTestCase2. How do I test if setContentView is called and set to the right resource once I call onCreate(null) on the activity in test?</p>
  
  <pre><code>private someActivity mActivity;
  protected void setUp() throws Exception {
    super.setUp();
    mActivity = getActivity();
  }
  
  public void testOnCreate() {
    assertNull(mActivity.findViewById(R.id.list_view));
  }
  </code></pre>