kotlinfixture icon indicating copy to clipboard operation
kotlinfixture copied to clipboard

Referencing other factories in one `kotlinFixture` block.

Open milgner opened this issue 2 years ago • 0 comments

When building complex data structures, I'd like to invoke other factories from within the current one.

Something along the lines of

val myFixtures = kotlinFixture {
    factory<MyComplexObject> { buildAComplexObject() }
    factory<AnotherObject> { AnotherObject(complexStuff = buildFromPreviousFactory<MyComplexObject>()) }
}

Unfortunately I haven't found a way to do this with the current API except through multiple kotlinFixture blocks. Any ideas?

milgner avatar Dec 05 '23 14:12 milgner