title: Android Activity lifecycle testing
body: <p>I have Activity, which is to save its data in case system decides to kill it while it is in the background.
  So, I’ve got onSaveInstanceState:</p>
  
  <pre><code>@Override
  protected void onSaveInstanceState(Bundle outState){
      outState.putString("value", "some_value");
  }
  </code></pre>
  
  <p>I check whether Bundle object is null in onCreate:</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      isRestarted=(savedInstanceState==null);
  </code></pre>
  
  <p>How do I write test method? I tried</p>
  
  <pre><code>    public void testRecreate(){
      Instrumentation mInstr=this.getInstrumentation();
      mInstr.callActivityOnSaveInstanceState(mActivity, null);
      mActivity.finish();
      mActivity=this.getActivity();
      assertEquals(false, mActivity.isRestarted);
  }
  </code></pre>
  
  <p>but it seems to be wrong.</p>