Is there a library that serializes data classes in...
# mockk
a
Is there a library that serializes data classes into compilable Kotlin code? Something like this:
Copy code
data class Thing(val color: String, val shape: String)
val myThing = Thing("Red", "Square")

serializeToSourceCode(myThing)
output:

Thing(color="Red", shape="Square")
The context: I am replacing an API call with a mock. I have a lot of integration tests that hit the actual API. I have a proxy for the API calls to go through. On every API call thru that proxy, I'd like to get something like this:
Copy code
every { myApi.callMethod(1, Thing("Red", "Square") } returns LocalDate.of(2020, 4, 30)
So that I don't have to type that manually.