DialogWithBlurredBackgroundLauncher implements BlurringImageListener { public static void showDialog(Activity activity, Dialog dialog) { new DialogWithBlurredBackgroundLauncher(activity).showDialog(dialog); } DialogWithBlurredBackgroundLauncher(Activity activity); static void showDialog(Activity activity, Dialog dialog); Dialog showDialog(Dialog dialog); @Override void onBlurringFinish(Bitmap blurredImage);  }
@Test public void shouldShowGivenDialog() { mDialogWithBlurredBackgroundLauncher.showDialog(dialog); AlertDialog alert = ShadowAlertDialog.getLatestAlertDialog(); assertThat(dialog).isEqualTo(alert); }
@Test public void shouldAddBlurredLayerToActivity() { mDialogWithBlurredBackgroundLauncher.showDialog(dialog); View blurLayer = exampleActivity.findViewById(R.id.blurLayer); assertThat(blurLayer).isNotNull(); }
@Test public void shouldRemovedBlurredLayerFromActivity() { mDialogWithBlurredBackgroundLauncher.showDialog(dialog); dialog.dismiss(); View blurLayer = exampleActivity.findViewById(R.id.blurLayer); assertThat(blurLayer).isNull(); }