I have a situation that in my unit tests I need to...
# komapper
d
I have a situation that in my unit tests I need to create an entity with all the fields in the database so that I can create an entry in the table (like when certain fields are not null), but in my actual production code, I only need to read/update tables, so I don't want all those fields... would there be an easy way to add the feature to define ONE separation mapping for both the entity in the test code and the entity in the production code? This could also be useful for DTOs that need to repeat certain fields...
t
How about you build your own KSP Processor? For example, you can generate entity classes for production from entity classes for testing.
d
My problem is that my test code needs more fields than the production code... and making a KSP processor for this is a bit overkill, and would involve doing it for more and more microservices... (also I don't really have experience with KSP yet...). One way or the other, this idea isn't really going to work, since my production code can't use value classes (micronaut doesn't serialize them to json...) and my entities do... so they're different types. I guess I'll resolve to mappers...