# BundleJUnitUtils

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

*** ** * ** ***


```
public final class BundleJUnitUtils
```

<br />

*** ** * ** ***

Utility methods to turn JUnit objects into bundles holding imitations that can be used by androidx.test.orchestrator.AndroidTestOrchestrator.

## Summary

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getBundleFromDescription(org.junit.runner.Description)(https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)` |
| `static https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getBundleFromFailure(org.junit.runner.notification.Failure)(https://junit.org/junit4/javadoc/latest/org/junit/runner/notification/Failure.html failure)` |
| `static https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getBundleFromResult(org.junit.runner.Result)(https://junit.org/junit4/javadoc/latest/org/junit/runner/Result.html result)` |
| `static https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getBundleFromThrowable(org.junit.runner.Description,java.lang.Throwable)(https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description, https://developer.android.com/reference/java/lang/Throwable.html throwable)` Generates a bundle from a description and a given error. |
| `static https://developer.android.com/reference/androidx/test/orchestrator/junit/ParcelableDescription` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getDescription(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` |
| `static https://developer.android.com/reference/androidx/test/orchestrator/junit/ParcelableFailure` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getFailure(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` |
| `static https://developer.android.com/reference/androidx/test/orchestrator/junit/ParcelableResult` | `https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils#getResult(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` |

## Public methods

### getBundleFromDescription

```
public static Bundle getBundleFromDescription(Description description)
```

### getBundleFromFailure

```
public static Bundle getBundleFromFailure(Failure failure)
```

### getBundleFromResult

```
public static Bundle getBundleFromResult(Result result)
```

### getBundleFromThrowable

```
public static Bundle getBundleFromThrowable(Description description, Throwable throwable)
```

Generates a bundle from a description and a given error.

| Parameters |
|---|---|
| `https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description` | A JUnit Description of the test |
| `https://developer.android.com/reference/java/lang/Throwable.html throwable` | The root exception cause |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | A bundle containing a ParcelableFailure constructed from the description and throwable |

### getDescription

```
public static ParcelableDescription getDescription(Bundle bundle)
```

### getFailure

```
public static ParcelableFailure getFailure(Bundle bundle)
```

### getResult

```
public static ParcelableResult getResult(Bundle bundle)
```