Run Parameterized Tests — Weak Accesses vs Constructor

Today I started adding some parameterized tests to my app, and I realised that there are not much documentation for Kotlin.

Anyway, the difficulty shouldn’t be really high as it’s much as it was in Java, except for Weak Accesses. I will try to make this as a manual to achieve a good test suite.

I want to talk about the difference between the Constructor access and the Weak access.

Imagine we want to do Unit tests in a RectangleModel like:

Parameterized tests Constructor Based:

Parameterized tests using Weak Accesses:

Note that you will have to use @JvmField annotation otherwise Java will see that parameter private if you’re coding in Kotlin!

Which one would you use, and why?
Comments are well received!