Skip to content

Instantly share code, notes, and snippets.

@maiatoday
Created January 26, 2018 13:17
Show Gist options
  • Save maiatoday/cfdcf730b78cb3a7ccff38a0018cab63 to your computer and use it in GitHub Desktop.
Save maiatoday/cfdcf730b78cb3a7ccff38a0018cab63 to your computer and use it in GitHub Desktop.
starcountCustomMatcher
fun hasStarCount(i: Int): Matcher<ContrivedParams> {
return object : TypeSafeMatcher<ContrivedParams>() {
override fun describeTo(description: Description) {
description.appendText("starCount should return ").appendValue(i)
}
override fun describeMismatchSafely(item: ContrivedParams, mismatchDescription: Description) {
mismatchDescription.appendText(" was ").appendValue(item.starCount)
}
override fun matchesSafely(item: ContrivedParams): Boolean {
return i == item.starCount
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment