{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ViewAssertion

interface ViewAssertion


Responsible for performing assertions on a View element.

This is considered part of the test framework public API - developers are free to write their own assertions as long as they meet the following requirements:

Strongly consider using a existing ViewAssertion via the ViewAssertions utility class before writing your own assertion.

Summary

Public functions

Unit
check(view: View!, noViewFoundException: NoMatchingViewException!)

Checks the state of the given view (if such a view is present).

Public functions

check

fun check(view: View!, noViewFoundException: NoMatchingViewException!): Unit

Checks the state of the given view (if such a view is present).

Parameters
view: View!

the view, if one was found during the view interaction or null if it was not (which may be an acceptable option for an assertion)

noViewFoundException: NoMatchingViewException!

an exception detailing why the view could not be found or null if the view was found