Function

assert

Asserts that the provided matcher is satisfied for this node.

assert

Source set: Common
public fun SemanticsNodeInteraction.assert(
    matcher: SemanticsMatcher,
    messagePrefixOnError: (() -> String)? = null,
): SemanticsNodeInteraction

Asserts that the provided matcher is satisfied for this node.

Parameters

matcher Matcher to verify.
messagePrefixOnError Prefix to be put in front of an error that gets thrown in case this assert fails. This can be helpful in situations where this assert fails as part of a bigger operation that used this assert as a precondition check.

Throws: AssertionError

if the matcher does not match or the node can no longer be found.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: