Hey 🙂
I’m currently fiddling around with
property-based-testing
in Kotest. I want to create a custom
arbitrary
based on already defined
arbitraries
. I found this page in the documentation about it:
https://kotest.io/docs/proptest/custom-generators.html#arbitrary
In the documentation there is a code snippet about doing it:
val personArb = arbitrary { rs ->
val names = Arb.string().values(rs)
val ages = <http://Arb.int|Arb.int>().values(rs)
names.zip(ages).map { (name, age) -> Person(name.value, age.value) }
}
The concept is clear, but the function
values(RandomSource)
is deprecated. What am I supposed to use as an alternative in this case? Would it be
generate(RandomSource)
? The replacement description is not really applicable for this particular case I think. Using
samples(RandomSource)
seems wrong, because I think it makes sense to keep the edge-cases of the arbs here 🤔 .