# 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
public final class AdditionalFailureInfo implements 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/androidx/media3/test/utils/AdditionalFailureInfo#AdditionalFailureInfo()()` |

| ### Public methods |
|---|---|
| `https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html` | `https://developer.android.com/reference/androidx/media3/test/utils/AdditionalFailureInfo#apply(org.junit.runners.model.Statement,org.junit.runner.Description)(https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html base, https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/AdditionalFailureInfo#setInfo(java.lang.String)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html info)` Sets the additional info to be added to any test failures. |

## Public constructors

### AdditionalFailureInfo

```
public AdditionalFailureInfo()
```

## Public methods

### apply

```
public Statement apply(Statement base, Description description)
```

### setInfo

```
public void setInfo(@Nullable String info)
```

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.