Skip to content

Commit

Permalink
Apply magicAssert to ImageViewAssertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sloy committed Dec 18, 2017
1 parent 5ffefe0 commit a26c1fe
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.support.annotation.IdRes
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.matcher.ViewMatchers.withId
import com.schibsted.spain.barista.internal.magicAssert
import com.schibsted.spain.barista.internal.matcher.DrawableMatcher.Companion.withAnyDrawable
import com.schibsted.spain.barista.internal.matcher.DrawableMatcher.Companion.withDrawable
import com.schibsted.spain.barista.internal.matcher.DrawableMatcher.Companion.withoutDrawable
Expand All @@ -13,16 +14,16 @@ object BaristaImageViewAssertions {

@JvmStatic
fun assertHasDrawable(@IdRes imageViewId: Int, @DrawableRes drawable: Int) {
onView(withId(imageViewId)).check(matches(withDrawable(drawable)))
withId(imageViewId) magicAssert withDrawable(drawable)
}

@JvmStatic
fun assertHasAnyDrawable(@IdRes imageViewId: Int) {
onView(withId(imageViewId)).check(matches(withAnyDrawable()))
withId(imageViewId) magicAssert withAnyDrawable()
}

@JvmStatic
fun assertHasNoDrawable(@IdRes imageViewId: Int) {
onView(withId(imageViewId)).check(matches(withoutDrawable()))
withId(imageViewId) magicAssert withoutDrawable()
}
}

0 comments on commit a26c1fe

Please sign in to comment.