What is an Observable
How to create an Observable
:
just
of
from
create
deferred
timer
What is the difference between cold and hot Observables
How does an Observable
stream end
What is an Observer
What is a subscription:
- How to subscribe to an
Observable
? - If you subscribe to an
Observable
, does it always send the whole stream? (test this specially withcreate
anddeferred
) - What is a
Disposable
? - What happens if a
Disposable
is disposed before the stream ends? - If nobody holds a
Disposable
instance, what happens?
What these operations do:
COMBINATION | FILTERING | MATHEMATICAL | TRANSFORMATION | UTILITY |
---|---|---|---|---|
combineLatest |
distinctUntilChanged |
count |
buffer |
delay |
concat |
elementAt |
reduce |
concatMap |
delaySubscription |
merge |
filter |
concatMapTo |
retry/retryWhen |
|
startWith |
debounce |
map |
||
withLatestFrom |
ignoreElements |
mapTo |
||
zip |
last |
scan |
||
sample |
||||
skip |
||||
skipUntil |
||||
skipWhile |
||||
take |
||||
takeLast |
||||
takeUntil |
||||
takeWhile |
||||
throttle |
PublishSubject
, BehaviorSubject
, Variable/BehaviorRelay
: What are the differences between each other and normal Observables/Observers
Variable
is in the process of being deprecated forBehaviorRelay
, essentially they do the same thing
What are, and what do they "guarantee":
Single
Maybe
Completable
ControlProperty
ControlEvent
Driver
What happens when you create a Single/Maybe
and emit an next event
twice?
What kind of errors do traits usually throw, and when?
How do you chain Observable
sequences? What about Completables
?
How do you apply/switch to different traits?
Observable
->Single | Maybe | Completable
Single
->Single | Maybe | Completable
Maybe
->Single | Maybe | Completable
Completable
->Single | Maybe | Completable
Some of the conversions above do not make sense, why?
What/where a Driver
is mostly used for/on?
What kind of schedulers are there (First must understand Threads
- Concurrent and Serial)
What is subscribeOn
and observeOn
How is a computation scheduled to a specific thread?
If your test target exposes an Observable
, what should be asserted of it?
Observables
are essentially encapsulated asyncronous operations:
- Do you need to assert the time the operation took?
- Do you need to assert only the results? Then how do you block execution while waiting for the stream to end?
- Do you need to assert which events are sent while modifying the source? Then how do you check the values received?
How would you create a testing hot/cold sequence? Look for TestScheduler
after trying to answer, and check which would work better for your test.