I have a large number of data converter tests to w...
# spek
r
I have a large number of data converter tests to write (model transformations). What is a good way to structure the tests for compactness and maintenance? Now I am using data classes with I can call
copy()
on to create different input to the test cases. Anything else? Examples appreciated!
r
Please include an example, so we have a better idea of what you're trying to do. :)
r
Copy code
data class LegacyEpisodeAttributes(
    val seasonNumber: Int,
    val episodeBroadcastNumber: Int,
    val numberOfEpisodesInSeason: Int,
    val shortEpisodeSynopsis: String?,
    val longEpisodeSynopsis: String?,
    val images: LegacyImages?
)

data class TvSeries(
    val id: String,
    val name: String,
    val shortDescription: String?,
    val longDescription: String?,
    val image: Image,
    val seasons: List<Season>
)

data class Season(
    val id: String,
    val name: String,
    val number: Int,
    val episodes: List<Episode>,
    val numberOfProducedEpisodes: Int
)

data class Episode(
    val id: String,
    val name: String?,
    val longDescription: String?,
    val shortDescription: String?,
    val tags: List<Tag>,
    val image: Image?,
    val number: Int?,
    val live: Live?
)
lets say I have a bunch of instances
LegacyEpisodeAttributes
which I want to convert to
TvSeries
Season
and
Episode
classes. There are many variations of indata which I need to test, to assert that the converter code works.
r
Can you paste a sample spec as well?