-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Labels
Description
Thanks for using RxJava but before you post an issue, please consider the following points:
- Please include the library version number, including the minor and patch version, in the issue text. In addition, if you'd include the major version in the title (such as
2.x) that would be great.
2.1.1
- If you think you found a bug, please include a code sample that reproduces the problem. Dumping a stacktrace is usually not enough for us.
// Fail
@Test
public void testConcatWithObserver() {
Observable<String> s = Observable.concat(Observable.just("abc"), Observable.just("def"));
AtomicReference<Disposable> disposable = new AtomicReference<>();
LinkedList<String> list = new LinkedList<>();
AtomicBoolean completed = new AtomicBoolean();
s.subscribe(new Observer<String>() {
public void onSubscribe(Disposable d) { disposable.set(d); }
public void onNext(String s) { list.add(s); }
public void onError(Throwable e) {}
public void onComplete() { completed.set(true); }
});
assertTrue(completed.get());
assertEquals(Arrays.asList("abc", "def"), list);
assertTrue(disposable.get().isDisposed());
}
// Pass
@Test
public void testConcatWithActions() {
Observable<String> s = Observable.concat(Observable.just("abc"), Observable.just("def"));
AtomicReference<Disposable> disposable = new AtomicReference<>();
LinkedList<String> list = new LinkedList<>();
AtomicBoolean completed = new AtomicBoolean();
s.subscribe(list::add, err -> {}, () -> completed.set(true), disposable::set);
assertTrue(completed.get());
assertEquals(Arrays.asList("abc", "def"), list);
assertTrue(disposable.get().isDisposed());
}
Reactions are currently unavailable