@Test public void updateCounter() throws Exception { final Activity mockInterceptedActivity = mock(TestActivity.class); final Activity mockNormalActivity = mock(Activity.class); notificationPressedInterceptorCounter.updateCounter(mockNormalActivity, true); assertThat(notificationPressedInterceptorCounter.hasActiveInterceptors(), equalTo(false)); notificationPressedInterceptorCounter.updateCounter(mockInterceptedActivity, true); assertThat(notificationPressedInterceptorCounter.hasActiveInterceptors(), equalTo(true)); notificationPressedInterceptorCounter.updateCounter(mockInterceptedActivity, false); assertThat(notificationPressedInterceptorCounter.hasActiveInterceptors(), equalTo(false)); }
void updateCounter(@NonNull final Activity activity, final boolean increment) { if (activity instanceof OnNotificationPressedInterceptor) { count += increment ? 1 : -1; } }
NotificationPressedInterceptorCounter { void updateCounter(@NonNull final Activity activity, final boolean increment) { if (activity instanceof OnNotificationPressedInterceptor) { count += increment ? 1 : -1; } } }
NotificationPressedInterceptorCounter { void updateCounter(@NonNull final Activity activity, final boolean increment) { if (activity instanceof OnNotificationPressedInterceptor) { count += increment ? 1 : -1; } } NotificationPressedInterceptorCounter(); }
NotificationPressedInterceptorCounter { void updateCounter(@NonNull final Activity activity, final boolean increment) { if (activity instanceof OnNotificationPressedInterceptor) { count += increment ? 1 : -1; } } NotificationPressedInterceptorCounter(); boolean hasActiveInterceptors(); }
NotificationPressedInterceptorCounter { void updateCounter(@NonNull final Activity activity, final boolean increment) { if (activity instanceof OnNotificationPressedInterceptor) { count += increment ? 1 : -1; } } NotificationPressedInterceptorCounter(); boolean hasActiveInterceptors();  }