# AndroidJUnit4

Artifact: [androidx.test:runner](https://developer.android.com/jetpack/androidx/releases/test) [View Source](https://cs.android.com/search?q=file:androidx/test/runner/AndroidJUnit4.java+class:androidx.test.runner.AndroidJUnit4)

*** ** * ** ***


```
class AndroidJUnit4 : Runner, Filterable, Sortable
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [org.junit.runner.Runner](https://junit.org/junit4/javadoc/latest/org/junit/runner/Runner.html) ||
|   | ↳ | [androidx.test.runner.AndroidJUnit4](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/test/ext/junit/runners/AndroidJUnit4` instead.

Aliases the current default Android JUnit 4 class runner, for future-proofing. If future versions of JUnit change the default Runner class, they will also change the definition of this class. Developers wanting to explicitly tag a class as an Android JUnit 4 class should use `@RunWith(AndroidJUnit4.class)`

## Summary

| ### Public constructors |
|---|
| `[AndroidJUnit4](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#AndroidJUnit4(java.lang.Class<?>))(klass: https://developer.android.com/reference/java/lang/Class.html<*>!)` **This function is deprecated.** Deprecated in Java |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[filter](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#filter(org.junit.runner.manipulation.Filter))(filter: https://junit.org/junit4/javadoc/latest/org/junit/runner/manipulation/Filter.html!)` **This function is deprecated.** Deprecated in Java |
| `https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!` | `[getDescription](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#getDescription())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[run](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#run(org.junit.runner.notification.RunNotifier))(runNotifier: https://junit.org/junit4/javadoc/latest/org/junit/runner/notification/RunNotifier.html!)` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[sort](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#sort(org.junit.runner.manipulation.Sorter))(sorter: https://junit.org/junit4/javadoc/latest/org/junit/runner/manipulation/Sorter.html!)` **This function is deprecated.** Deprecated in Java |

### Inherited functions

From [org.junit.runner.Runner](https://junit.org/junit4/javadoc/latest/org/junit/runner/Runner.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[testCount](https://junit.org/junit4/javadoc/latest/org/junit/runner/Runner.html#testCount--)()`

**This function is deprecated.** Deprecated in Java

## Public constructors

### AndroidJUnit4

```
[AndroidJUnit4](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#AndroidJUnit4(java.lang.Class<?>))(klass: Class<*>!)
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Used when executed with standard junit runner. Will attempt to delegate to RobolectricTestRunner or delegate provided by android.junit.runner system property.

## Public functions

### filter

```
fun [filter](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#filter(org.junit.runner.manipulation.Filter))(filter: Filter!): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

| Throws |
|---|---|
| `https://junit.org/junit4/javadoc/latest/org/junit/runner/manipulation/NoTestsRemainException.html` |   |

### getDescription

```
fun [getDescription](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#getDescription())(): Description!
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

### run

```
fun [run](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#run(org.junit.runner.notification.RunNotifier))(runNotifier: RunNotifier!): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

### sort

```
fun [sort](https://developer.android.com/reference/kotlin/androidx/test/runner/AndroidJUnit4#sort(org.junit.runner.manipulation.Sorter))(sorter: Sorter!): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java