1

There is a class:

data class A(
    var id: Long = 0,
    var date: String? = null,
    var age: Long,
    var sex: String? = null,
    var city: String? = null
)
Object: val obj = A(id = 5, age = 22, sex = "male", city = "Example city")

There is a map:

val map = mapOf("age" to 22, "city" to "Example city")

How to compare map and object using kotest? so that they are equal

lomdok
  • 21
  • 2
  • I don't think there's a native way to compare a data class with a map that has its properties as keys. What you can do is convert it to Json and compare Jsons, or turn it to a map and compare both maps. – LeoColman Jul 14 '23 at 00:10

0 Answers0