# BundleJUnitUtils

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/orchestrator/junit/BundleJUnitUtils "View this page in Java")

<br />

```
class BundleJUnitUtils
```

<br />

*** ** * ** ***

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

## Summary

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

## Public functions

### getBundleFromDescription

```
java-static fun getBundleFromDescription(description: Description!): Bundle!
```  

### getBundleFromFailure

```
java-static fun getBundleFromFailure(failure: Failure!): Bundle!
```  

### getBundleFromResult

```
java-static fun getBundleFromResult(result: Result!): Bundle!
```  

### getBundleFromThrowable

```
java-static fun getBundleFromThrowable(description: Description!, throwable: Throwable!): Bundle!
```

Generates a bundle from a description and a given error.  

|                                                Parameters                                                |
|----------------------------------------------------------------------------------------------------------|---------------------------------|
| `description: `[Description](https://junit.org/junit4/javadoc/4.12/org/junit/runner/Description.html)`!` | A JUnit Description of the test |
| `throwable: `[Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)`!`  | The root exception cause        |

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

### getDescription

```
java-static fun getDescription(bundle: Bundle!): ParcelableDescription!
```  

### getFailure

```
java-static fun getFailure(bundle: Bundle!): ParcelableFailure!
```  

### getResult

```
java-static fun getResult(bundle: Bundle!): ParcelableResult!
```