Utils { public static void unsubscribe(Subscription subscription) { if (subscription != null && !subscription.isUnsubscribed()) { subscription.unsubscribe(); } } private  Utils(); static void openPlayStorePage(Context context); static void openPrivacyPolicyPage(Context context); static String getFormattedTitle(String titleFormat, String... strings); static boolean hasNetworkConnection(Context context); static void setNotificationAlarm(Context context, LocalTime localTime); static void cancelNotificationAlarm(Context context); static void setWidgetUpdateAlarm(Context context); static void cancelWidgetUpdateAlarm(Context context); static void restartApp(Activity activity); static int getCurrentWeekNumber(); static int getWeekNumber(LocalDate localDate); static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday); static void unsubscribe(Subscription subscription); static void unsubscribeComposite(CompositeSubscription compositeSubscription); static int[] getAppWidgetIds(Context context);  }
@Test public void unsubscribeTest() { Subscription subscription = Mockito.mock(Subscription.class); Utils.unsubscribe(subscription); verify(subscription, times(1)).unsubscribe(); verify(subscription, times(1)).isUnsubscribed(); }