I have a util object class for Menu:
object MenuUtil{
fun updateMenuIconTint(menu: Menu, @ColorInt color: Int) {
menu.forEach{
it.updateTint(color)
}
}
fun MenuItem.updateTint(@ColorInt color: Int){
var icDrawable = DrawableCompact.wrap(icon)
icDrawable = iconDrawable.mutate()
DrawableCompat.setTintList(icDrawable, ColorStateList.valueOf(color))
}
}
How can I mock Menu and MenuItem in order to test those functions in a unit test?
When attempting to do so I am told that Menu is an interface.
from How can I mock a Menu item in order to Unit Test a Menu in AndroidStudio (kotlin)?
No comments:
Post a Comment