https://kotlinlang.org logo
#kotest
Title
# kotest
d

dave08

05/18/2021, 1:56 PM
Should I make an Arb for each one using a function that takes the
entity1Id
as a parameter, or is there a better way?
s

sam

05/18/2021, 1:57 PM
Yes. Arb for entity2 just takes entity1 arb and can randomly choose to use one or leave null
Arb.bind might be useful
d

dave08

05/18/2021, 2:02 PM
just takes entity1 arb
using the function param, instead of just passing an id?
fun entity2Arb(entity1: Entity1)?
s

sam

05/18/2021, 2:03 PM
Yeah that's good. But you need to generate the entity1 too. You could just end up with an arb that generates both
d

dave08

05/18/2021, 2:05 PM
You mean in a Pair or some other containing data class... or just using bind on generated entity1 and entity2, and modify entity2's entity1Id in the function passed to bind?
s

sam

05/18/2021, 2:06 PM
Yeah a pair
d

dave08

05/18/2021, 2:08 PM
Ok thanks!
13 Views