# Parcelables

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

*** ** * ** ***


```
public final class Parcelables
```

<br />

*** ** * ** ***

Testing utilities for `https://developer.android.com/reference/android/os/Parcelable.html`s.

## Summary

| ### Public methods |
|---|---|
| `static T` | `<T extends https://developer.android.com/reference/android/os/Parcelable.html> https://developer.android.com/reference/androidx/test/core/os/Parcelables#forceParcel(T,android.os.Parcelable.Creator<T>)(T parcelable, https://developer.android.com/reference/android/os/Parcelable.Creator.html<T> creator)` Parcelables are lazily marshalled, meaning that in typical testing, no marshalling would occur and would therefore go untested. |

## Public methods

### forceParcel

```
public static T <T extends Parcelable> forceParcel(T parcelable, Parcelable.Creator<T> creator)
```

Parcelables are lazily marshalled, meaning that in typical testing, no marshalling would occur and would therefore go untested. This forces marshalling to happen for a Parcelable.

This utility will marshall the provided Parcelable, and attempt to recreate it with the given CREATOR. It is up to the caller to validate the two instances are equivalent.

| Parameters |
|---|---|
| `T parcelable` | the parcelable to marshall. |
| `https://developer.android.com/reference/android/os/Parcelable.Creator.html<T> creator` | the CREATOR field for that parcelable. |

| Returns |
|---|---|
| `T` | a new instance of the parcelable that has been unmarshalled. |