---
title: "assert"
description: "Asserts that the provided [matcher] is satisfied for this node."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
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. |




