mvrx-mocking / com.airbnb.mvrx.mocking / DataClassSetDsl / success

success

open fun <T, Type> Async<T>.success(block: T.() -> KProperty0<Type>): KProperty0<Type>

Use this to update the property value of an Async's type when it is in the Success state. This will throw an exception if the Async it is used on is not Success.

Example: state.set { ::myAsync { success { ::text } } }.with { "hello" }

If you would like to replace the whole value of the Success object you can instead do state.set { ::myAsync }.with { Success(MyClass(text = "hello")) }