vendredi 7 juin 2019

How to test data class on Kotlin?

I have data class'es in my Kotlin project, what I use for JSON Rest responses.. Example:

data class WeatherResponse(val city: String, val temperature: Double, val humidity: Double)

To fullfill code coverage constraints, I would like to write some tests for above data class.

What unit tests would make sense for Kotlin data classes?

I thought of create a WeatherResponse object and a corresponding JSON String (response from server), parse that String to a WeatherResponse object and compare?

Aucun commentaire:

Enregistrer un commentaire