### Question:
LoadingDialogFragment extends SenseDialogFragment { public static @NonNull LoadingDialogFragment show(@NonNull final FragmentManager fm, @Nullable final String title, final int flags) { final LoadingDialogFragment preexistingDialog = (LoadingDialogFragment) fm.findFragmentByTag(TAG); if (preexistingDialog != null) { if (flags == preexistingDialog.getFlags()) { preexistingDialog.setTitle(title); return preexistingDialog; } else { preexistingDialog.dismiss(); } } final LoadingDialogFragment dialog = LoadingDialogFragment.newInstance(title, flags); dialog.show(fm, TAG); return dialog; }  static @NonNull LoadingDialogFragment show(@NonNull final FragmentManager fm,
                                                      @Nullable final String title,
                                                      final int flags); static @NonNull LoadingDialogFragment show(@NonNull final FragmentManager fm); static void close(@NonNull final FragmentManager fm); static void closeWithOnComplete(@NonNull final FragmentManager fm, @Nullable final Runnable onCompletion); static void closeWithDoneTransition(@NonNull final FragmentManager fm, @Nullable final Runnable onCompletion); static void closeWithMessageTransition(@NonNull final FragmentManager fm,
                                                  @Nullable final Runnable onCompletion,
                                                  @StringRes final int messageRes); static LoadingDialogFragment newInstance(@Nullable final String title, @Config final int flags); @Override void onCreate(final Bundle savedInstanceState); @Override @NonNull Dialog onCreateDialog(final Bundle savedInstanceState); @Override void onDestroy(); void setTitle(@Nullable final String title); void setDismissMessage(@StringRes final int messageRes); void setOnShowListener(@NonNull final SenseAlertDialog.SerializedRunnable onShow); void setLockOrientation(); int getFlags(); void dismissWithOnComplete(@Nullable final Runnable onCompletion, final long delay); void dismissWithDoneTransition(@Nullable final Runnable onCompletion); static final String TAG; static final long DURATION_DONE_MESSAGE; static final long DURATION_DEFAULT; static final int OPAQUE_BACKGROUND; static final int DEFAULTS; }### Answer:
@Test public void showDoesNotDismissPreExistingDialogWhenSameFlags() throws Exception { final Activity testActivity = Robolectric.setupActivity(Activity.class); final FragmentManager fragmentManager = testActivity.getFragmentManager(); final LoadingDialogFragment preExisting = LoadingDialogFragment.show(fragmentManager, "preExisting", LoadingDialogFragment.OPAQUE_BACKGROUND); fragmentManager.executePendingTransactions(); final LoadingDialogFragment newDialogFragment = LoadingDialogFragment.show(fragmentManager, "newDialog", LoadingDialogFragment.OPAQUE_BACKGROUND); assertThat(newDialogFragment, equalTo(preExisting)); }