# LayoutElementAssertion

Artifact: [androidx.wear.protolayout:protolayout-testing](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/testing/LayoutElementAssertion.kt+class:androidx.wear.protolayout.testing.LayoutElementAssertion) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

*** ** * ** ***


```
public final class LayoutElementAssertion
```

<br />

*** ** * ** ***

Represents a layout element that can be asserted on.

An instance of \[LayoutElementAssertion\] can be obtained from 'onElement' method on a
\[LayoutElementAssertionsProvider\].

## Summary

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementAssertion` | `https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementAssertion#assert(androidx.wear.protolayout.testing.LayoutElementMatcher)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementMatcher matcher)` Asserts that the provided `https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementMatcher` is satisfied for this element. |
| `final void` | `https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementAssertion#assertDoesNotExist()()` Asserts that no element was found in the element tree. |
| `final void` | `https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementAssertion#assertExists()()` Asserts that the element was found in the element tree. |

## Public methods

### assert

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

```
public final @NonNull LayoutElementAssertion assert(@NonNull LayoutElementMatcher matcher)
```

Asserts that the provided `https://developer.android.com/reference/androidx/wear/protolayout/testing/LayoutElementMatcher` is satisfied for this element.

### assertDoesNotExist

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

```
public final void assertDoesNotExist()
```

Asserts that no element was found in the element tree.

### assertExists

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.3.0)

```
public final void assertExists()
```

Asserts that the element was found in the element tree.