---
title: "SemanticsMatcher"
description: "Wrapper for semantics matcher lambdas that allows to build string explaining to the developer
what conditions were being tested."
type: "class"
---

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


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class SemanticsMatcher(val description: String, private val matcher: (SemanticsNode) -> Boolean)
```


Wrapper for semantics matcher lambdas that allows to build string explaining to the developer
what conditions were being tested.


## Functions

```kotlin
fun matches(node: SemanticsNode): Boolean
```


Returns whether the given node is matched by this matcher.


```kotlin
fun matchesAny(nodes: Iterable<SemanticsNode>): Boolean
```


Returns whether at least one of the given nodes is matched by this matcher.


```kotlin
infix fun and(other: SemanticsMatcher): SemanticsMatcher
```

```kotlin
infix fun or(other: SemanticsMatcher): SemanticsMatcher
```

```kotlin
operator fun not(): SemanticsMatcher
```

## Companion Object

#### Methods

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun <T> expectValue(key: SemanticsPropertyKey<T>, expectedValue: T): SemanticsMatcher
```


Builds a predicate that tests whether the value of the given `key` is equal to
`expectedValue`.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun <T> keyIsDefined(key: SemanticsPropertyKey<T>): SemanticsMatcher
```


Builds a predicate that tests whether the given `key` is defined in semantics.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun <T> keyNotDefined(key: SemanticsPropertyKey<T>): SemanticsMatcher
```


Builds a predicate that tests whether the given `key` is NOT defined in semantics.





