# AdditionalFailureInfo

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

*** ** * ** ***


```
@UnstableApi
class AdditionalFailureInfo : TestRule
```

<br />

*** ** * ** ***

A JUnit `https://junit.org/junit4/javadoc/latest/org/junit/Rule.html` that attaches additional info to any errors/exceptions thrown by the test.

This is useful for tests where the line-number from a stacktrace doesn't provide enough detail about the failure, for example when an assertion fails inside a loop.

This can be preferable to many calls to `https://truth.dev/api/0.41/com/google/common/truth/Truth.html#assertWithMessage-java.lang.String-` because it will also add info to errors/exceptions that bubble out from the system-under-test.

Includes special handling for `https://developer.android.com/reference/java/lang/AssertionError.html` to ensure that test failures are correctly distinguished from test errors (all other errors/exceptions).

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/AdditionalFailureInfo#AdditionalFailureInfo()()` |

| ### Public functions |
|---|---|
| `https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/AdditionalFailureInfo#apply(org.junit.runners.model.Statement,org.junit.runner.Description)(base: https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html!, description: https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/AdditionalFailureInfo#setInfo(java.lang.String)(info: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Sets the additional info to be added to any test failures. |

## Public constructors

### AdditionalFailureInfo

```
AdditionalFailureInfo()
```

## Public functions

### apply

```
fun apply(base: Statement!, description: Description!): Statement!
```

### setInfo

```
fun setInfo(info: String?): Unit
```

Sets the additional info to be added to any test failures. Pass `null` to skip adding any additional info.

Can be called from any thread.