states
Assert that the expected sequence of state changes has been emitted.
The initial state is asserted automatically, only assert further states.
Every assertion is a lambda with the previous state as the receiver. It is therefore recommended to use copy to make your tests more concise and readable.
We are more interested in how the state changed from the previous one, rather than what it currently is.
testSubject.assert {
states(
{ copy(count = 2) },
{ copy(count = 4) },
{ copy(finished = true) }
)
}Content copied to clipboard
Parameters
expected State Changes
A list of expected state changes. Each lambda has the previous state as the receiver.