Now the challenge is that if I call in my test `ma...
# announcements
i
Now the challenge is that if I call in my test
makeCashPeriod()
I get a nice randomized model, but I need to change some of the parameters depending by the test. Can I achieve that with the language from intelliJ usign something ,do not know, maybe generics, default constructor values, other?
c
You could move the default parameters from
CashPeriod
constructor to
makeCashPeriod
function. That way if you don't specify a parameter, it will be random, if you do, it will be whatever you specified.
i
mmh thanks, but in this way does not work to me because
i am stupid:)
it works as a charm thanks
Copy code
fun makeCashPeriod(
        period: String = randomString(),
        status: String = randomString(),
        type: String = randomString(),
        numberOfEntries: Int = randomInt(),
        isCashCountRequired: Boolean = randomBoolean(),
        mutationBalance: String = randomString(),
        canBeClosed: Boolean = randomBoolean(),
        remark: String = randomString()
    )CashPeriod = CashPeriod(period, status, type, numberOfEntries, isCashCountRequired, mutationBalance, canBeClosed, remark)