kosi-libs / MocKMP

A mocking processor for Kotlin Multiplatform
https://kosi-libs.org/mockmp
MIT License
183 stars 12 forks source link

Naming collision on generated fakes #57

Closed afonsograca closed 1 year ago

afonsograca commented 1 year ago

Hi there,

I'm using a library that contains a couple of classes like this:

data class Foo(...) {
   data class Data(...) 
}

data class Bar(...) {
   data class Data(...) 
}

When trying to write tests, I'd like to generate fakes based on those Data classes, and so I added

@UsesFakes(Foo.Data::class)

and

@UsesFakes(Bar.Data::class)

to their respective cases.

Unfortunately I get a kotlin.io.FileAlreadyExistsException where fakeData already exists. Is there a way to give a custom name to the fake? something like

@UsesFakes(Foo.Data::class as FooData)

Cheers!

SalomonBrys commented 1 year ago

Fix released in v1.14.0.