# 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)

*** ** * ** ***


```
public final class SkipUnsupportedDeviceActionsRule implements 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:

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

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

## Summary

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

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

## Public constructors

### SkipUnsupportedDeviceActionsRule

```
public SkipUnsupportedDeviceActionsRule()
```

## Public methods

### apply

```
public @NonNull Statement apply(@NonNull Statement statement, @NonNull Description description)
```