title: DialogFragment with Roboelctric
body: <p>I wanted to test if a dialog Fragment is shown or not, with <strong>Roboelectric</strong>.</p>
  
  <pre><code>public class SomeDialogActivity extends FragmentActivity {
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          DialogFragment someDialogFragment = new SomeDialogFragment();
          someDialogFragment.show(getSupportFragmentManager(), "some_dialog");
      }
  }
  </code></pre>
  
  <p>Now I wanted to test if this dialog is shown, something like this:</p>
  
  <pre><code>@Test
  public void dialogFragmentIsShownToTheUser() {
          DialogFragment dialog = new SomeDialogFragment();
          DialogFragment someDialogFragment = new SomeDialogFragment();
          startFragment(someDialogFragment);
  
          SomeDialogActivity activity = Robolectric.setupActivity(SomeDialogActivity.class);
  
          Dialog dialog = ShadowDialog.getLatestDialog();
          assertNotNull(dialog);
          assertEquals(.... , ....)
  }
  </code></pre>