'Scala - handle Eithers in property based testing
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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
