BaseIntent { public boolean startWith(@NonNull final IntentStarter starter) { final Context context = starter.getContext(); final Intent intent = build(context); if (isActivityForIntentAvailable(context, intent)) { return onStartWith(starter, intent); } notifyActivityNotFound(context); return false; }  @SuppressWarnings("unchecked") I dialogTitle(@Nullable final CharSequence title); @NonNull CharSequence dialogTitle(); @SuppressWarnings("unchecked") I activityNotFoundMessage(@Nullable final CharSequence message); @NonNull CharSequence activityNotFoundMessage(); I enterTransition(@AnimRes final int transition); @AnimRes int enterTransition(); I exitTransition(@AnimRes final int transition); @AnimRes int exitTransition(); @SuppressWarnings("unchecked") I transitions(@AnimRes final int enterTransition, @AnimRes final int exitTransition); boolean startWith(@NonNull final IntentStarter starter); @NonNull Intent build(@NonNull final Context context); @CheckResult static boolean isActivityForIntentAvailable(@NonNull final Context context, @NonNull final Intent intent);  }
@Test public void testStartWithUnavailableActivity() { final IntentStarter mockStarter = mock(IntentStarter.class); when(mockStarter.getContext()).thenReturn(context); final BaseIntent intent = new BaseIntent() { @Override @NonNull protected Intent onBuild(@NonNull final Context context) { return new Intent("ACTION.Test"); } }; intent.startWith(mockStarter); verify(mockStarter, times(0)).startIntent(any(Intent.class)); verify(mockStarter, times(0)).overridePendingTransition(anyInt(), anyInt()); }