Created
October 13, 2018 23:11
-
-
Save cdmunoz/b703168714cdeff4a45dbcbb68349925 to your computer and use it in GitHub Desktop.
WhitListSize: Custom Espresso Matcher which checks if a ListView has an specific size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun withListSize(size: Int): Matcher<View> { | |
return object : TypeSafeMatcher<View>() { | |
public override fun matchesSafely(view: View): Boolean { | |
return (view as ListView).count == size | |
} | |
override fun describeTo(description: Description) { | |
description.appendText("ListView should have $size items") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment