https://kotlinlang.org logo
Title
d

dmcg

07/14/2019, 10:57 AM
So, back in harness after a while! For a long time I’ve been sitting on the feature of automatically supplying the fixture if it is an
object
or a class with a no-arg ctor. I haven’t finished it because the pain of
fixture { MyFixture() }
wasn’t high for me, and I want to encourage (largely) immutable fixtures rather than the JUnit build-default-and-configure style. On the other hand, migration from a JUnit test is made easier. What do people think?
r

robfletcher

07/14/2019, 4:58 PM
I, for one, would enjoy that feature
👍 1
Never occurred to me to use an
object
. That… is interesting.
c

christophsturm

07/15/2019, 10:34 AM
how would that look?
fixture { MyFixture() }
is not very verbose
d

dmcg

07/15/2019, 10:35 AM
For the supported cases you would just not need to invoke
fixure {
at all
c

christophsturm

07/15/2019, 10:37 AM
ah right because the fixture type is the generic type of the context. yeah why not, i mean people can still declare it if they want to.
r

robfletcher

07/15/2019, 3:26 PM
yeah, I’ve found myself doing less and less parameterization of fixtures over time. Often I might have edge cases where I use
deriveFixture
and
copy
to change a property or two, but most of the time the fixture is initializing itself.