I could not find `Arb.create(fn)` function in Kote...
# kotest
m
I could not find
Arb.create(fn)
function in Kotest 5.8.0, even though it is still shown on the Generators List page of the docs.
e
Thanks, removed it from the docs
m
What should I use instead? I have been using
Arb.bind()
but only want to specify one
Arb
type. What am I missing?
e
Do you want a reflective arb for a certain type? Or do you have a value you want to turn into an Arb?
m
I want to generate exception classes with generated messages. I have this, because I don’t know better:
Copy code
val genMessage = Arb.string(1, 120)
val genException = Arb.bind(listOf(genMessage)) { messages -> Exception(messages.first()).fillInStackTrace() }
Is there a better way to specify an exception generator?
e
maybe this?
Copy code
val genException = Arb.string(1, 120).map { message -> Exception(message).fillInStackTrace() }
m
Thank you! I didn’t know about
map()
function. It shows I need to read more of the documentation.
e
No problem 🙂 sometimes it's easier to just ask 👍 fun to see property testing being used in other open-source projects.