# SkipUnsupportedDeviceActionsRule

Artifact: [androidx.test.espresso:espresso-device](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/device/rules/SkipUnsupportedDeviceActionsRule.kt+class:androidx.test.espresso.device.rules.SkipUnsupportedDeviceActionsRule)

*** ** * ** ***


```
class SkipUnsupportedDeviceActionsRule : TestRule
```

<br />

*** ** * ** ***

Rule for skipping tests when a device action is called on an unsupported device.

DeviceActions throw UnsupportedDeviceOperationExceptions when actions cannot be performed on the test device. This rule catches those exceptions and skips the tests where they are thrown. Without this rule, tests will fail when a device action is performed on an unsupported device.

Example usage:

```kotlin
class SampleTest {
  @get:Rule
  val rule = SkipUnsupportedDeviceActionsRule()

  @Test
  fun testDeviceActions() {
    onDevice().setFlatMode()
  }
}
```

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/test/espresso/device/rules/SkipUnsupportedDeviceActionsRule#SkipUnsupportedDeviceActionsRule()()` |

| ### Public functions |
|---|---|
| `open https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/device/rules/SkipUnsupportedDeviceActionsRule#apply(org.junit.runners.model.Statement,org.junit.runner.Description)(statement: https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html, description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html)` |

## Public constructors

### SkipUnsupportedDeviceActionsRule

```
SkipUnsupportedDeviceActionsRule()
```

## Public functions

### apply

```
open fun apply(statement: Statement, description: Description): Statement
```