class Totals {
val subTotals = mutableMapOf<String, SubTotals >()
}
data class SubTotals(
val x: Int = 0,
val y: Int = 0
)
every { getTotals() } returns Totals(
subTotals = mutableMapOf("Bag" to SubTotals(10, 100)))
When I try to mockk() Totals I get cannot find a parameter with this name 'subTotals'
You should move subTotals to constructor
From
class Totals {
val subTotals = mutableMapOf<String, SubTotals>()
}
to
class Totals(
val subTotals: MutableMap<String, SubTotals> = mutableMapOf()
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.