I am developing an Android application using Kotlin. I am adding instrumented tests to my application. I am having a problem testing the background of textview if it's right drawable set in XML resource.
I am setting the background of the text view programmatically like this.
when (type) {
ApplicationController.EVENT_TYPE_FUTURE -> {
detailsViewHolder.tvStatus.setBackgroundResource(R.drawable.background_future_event)
}
ApplicationController.EVENT_TYPE_PAST -> {
detailsViewHolder.tvStatus.setBackgroundResource(R.drawable.background_past_event)
}
ApplicationController.EVENT_TYPE_CURRENT -> {
detailsViewHolder.tvStatus.setBackgroundResource(R.drawable.background_current_event)
}
}
In the expresso, I want to assert that the text view is set with the right XML resource. How can I do that?