Reputation: 13
I am creating property based tests for my scala project but I don't know how I should handle Eithers in my generators. Here's an example.
def genCompany: Gen[Company] =
for {
letter <- Gen.oneOf('A' to 'Z')
company = Company.from(letter.toString()) //-> returns Either[Error, Company]
} yield company
Should I change the return type to Gen[Either[Error, Company]]
?
If so, how would I use this generator inside other generators?
Thank you very much!
Upvotes: 0
Views: 59