Does anyone have any tips on how to properly manage large data literals in Kotlin tests? I'm writing unit tests for data mapping, so I have to do this:
1. Create test input data
2. Create expected output data
3. Perform mapping
4. Make sure output of the matches matches expected data
Problem is that input and/or output data can be big data class with lots of nested data, which means that 95% of the code in the test function is just creating those data classes, creating a big mess.
I could move this out of test methods, but every single test method has slightly different data (since it tests different thing), so I cannot have one universal constant with that data class in. I could move the data to resources as some kind of structure (such as JSON), but then I also have to build and maintain deserialization of that data for tests.