@Test
public void setOnceTwice() {

    List<Throwable> errors = TestHelper.trackPluginErrors();
    try {
        AtomicReference<Disposable> target = new AtomicReference<Disposable>();
        Disposable d = Disposables.empty();
        DisposableHelper.setOnce(target, d);
        Disposable d1 = Disposables.empty();
        DisposableHelper.setOnce(target, d1);
        assertTrue(d1.isDisposed());
        TestHelper.assertError(errors, 0, IllegalStateException.class, "Disposable already set!");
    } finally {
        RxJavaPlugins.reset();
    }
}