//Extensions for Jetpack Lifecycle/it.czerwinski.android.lifecycle.livedata.test/TestObserver
TestObserver
[androidJvm] class TestObserver<T> : Observer<T>
A callback testing values emitted by LiveData.
Since
1.1.0
Types
Name | Summary |
---|---|
Companion | [androidJvm] Content object Companion |
Functions
Name | Summary |
---|---|
assertNoValues | [androidJvm] Content fun assertNoValues(): TestObserver<T> More info Assert that this observer received no onChanged events. |
assertValue | [androidJvm] Content fun assertValue(value: T): TestObserver<T> More info Asserts that this observer received exactly one onChanged value, equal to the given value. [androidJvm] Content fun assertValue(predicate: (T) -> Boolean): TestObserver<T> More info Asserts that this observer received exactly one onChanged value, for which the given predicate returns true. |
assertValueAt | [androidJvm] Content fun assertValueAt(index: Int, value: T): TestObserver<T> More info Asserts that this observer received an onChanged value at the given index, equal to the given value. [androidJvm] Content fun assertValueAt(index: Int, predicate: (T) -> Boolean): TestObserver<T> More info Asserts that this observer received an onChanged value at the given index, for which the given predicate returns true. |
assertValueCount | [androidJvm] Content fun assertValueCount(count: Int): TestObserver<T> More info Assert that this observer received the specified number onChanged events. |
assertValues | [androidJvm] Content fun assertValues(vararg values: T): TestObserver<T> fun assertValues(values: Iterable<T>): TestObserver<T> More info Asserts that this observer received only the specified values in the exact specified order. |
assertValueSet | [androidJvm] Content fun assertValueSet(values: Collection<T>): TestObserver<T> More info Asserts that this observer received only the specified values, irrespective of the order. |
onChanged | [androidJvm] Content open override fun onChanged(t: T) More info Called when the observed LiveData emits a new value. |
valueCount | [androidJvm] Content fun valueCount(): Int More info Returns the number of received onChanged values. |
values | [androidJvm] Content fun values(): List<T> More info Returns a list of received onChanged values. |