Disposables { @NonNull public static Disposable fromSubscription(@NonNull Subscription subscription) { ObjectHelper.requireNonNull(subscription, "subscription is null"); return new SubscriptionDisposable(subscription); } private  Disposables(); @NonNull static Disposable fromRunnable(@NonNull Runnable run); @NonNull static Disposable fromAction(@NonNull Action run); @NonNull static Disposable fromFuture(@NonNull Future<?> future); @NonNull static Disposable fromFuture(@NonNull Future<?> future, boolean allowInterrupt); @NonNull static Disposable fromSubscription(@NonNull Subscription subscription); @NonNull static Disposable empty(); @NonNull static Disposable disposed();  }
@Test(expected = NullPointerException.class) public void fromSubscriptionNull() { Disposables.fromSubscription(null); }
@Test public void fromSubscription() { Subscription s = mock(Subscription.class); Disposables.fromSubscription(s).dispose(); verify(s).cancel(); verify(s, never()).request(anyInt()); }