Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@

import static org.junit.jupiter.api.Assertions.*;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.*;

import org.junit.jupiter.api.parallel.Isolated;

import io.reactivex.rxjava4.core.*;
import io.reactivex.rxjava4.disposables.Disposable;
import io.reactivex.rxjava4.schedulers.Schedulers;

/**
* Test Completable methods and operators.
Expand All @@ -34,17 +32,20 @@ public class CompletableIsolatedTest extends RxJavaTest {
public void repeatNormal() {
final AtomicReference<Throwable> err = new AtomicReference<>();
final AtomicInteger calls = new AtomicInteger();
final AtomicReference<Disposable> disposable = new AtomicReference<>();

Completable c = Completable.fromCallable(() -> {
calls.getAndIncrement();
if (calls.incrementAndGet() == 6) {
disposable.get().dispose();
}
Thread.sleep(200);
return null;
}).repeat();

c.subscribe(new CompletableObserver() /* NFI */ {
@Override
public void onSubscribe(final Disposable d) {
Schedulers.single().scheduleDirect(d::dispose, 1100, TimeUnit.MILLISECONDS);
disposable.set(d);
}

@Override
Expand Down
Loading