anyForSubtypeOf

@API(status = API.Status.EXPERIMENTAL, since = "1.8.4")
inline fun <T : Any> anyForSubtypeOf(enableArbitraryRecursion: Boolean = false, crossinline subtypeScope: SubtypeScope<T>.() -> Unit = {}): Arbitrary<T>

Creates Arbitrary with subtypes of a sealed class or interface T. If a subtype is a sealed class or interface, its subtypes are used to create Arbitrary. This is done recursively. TypeArbitrary are created by default under the hood, but this can be customized, for each subtype, with SubtypeScope.provide .

anyForSubtypeOf<MyInterface> {
provide<MyImplementation1> { customArbitrary1() }
provide<MyImplementation2> { customArbitrary2() }
}

Parameters

enableArbitraryRecursion

is applied to all created TypeArbitrary.