Class TestObserver<T>

java.lang.Object
io.reactivex.rxjava4.observers.BaseTestConsumer<T, TestObserver<T>>
io.reactivex.rxjava4.observers.TestObserver<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
CompletableObserver, MaybeObserver<T>, Observer<T>, SingleObserver<T>

public class TestObserver<T> extends BaseTestConsumer<T, TestObserver<T>> implements Observer<T>, MaybeObserver<T>, SingleObserver<T>, CompletableObserver
An Observer, MaybeObserver, SingleObserver and CompletableObserver composite that can record events from Observables, Maybes, Singles and Completables and allows making assertions about them.

You can override the onSubscribe(Disposable), onNext(Object), onError(Throwable), onComplete() and onSuccess(Object) methods but not the others (this is by design).

Since 4.0.0, the TestObserver does implements Disposable anymore. Use asDisposable() to create a wrapper that calls the dispose().

See Also: