# Parcelables

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/core/os/Parcelables "View this page in Java")

<br />

```
class Parcelables
```

<br />

*** ** * ** ***

Testing utilities for[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)s.

## Summary

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

## Public functions

### forceParcel

```
java-static fun <T : Parcelable?> forceParcel(parcelable: T!, creator: Parcelable.Creator<T!>!): T!
```

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                                                     |
|--------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| `parcelable: T!`                                                                                                   | the parcelable to marshall.            |
| `creator: `[Parcelable.Creator](https://developer.android.com/reference/android/os/Parcelable.Creator.html)`<T!>!` | the CREATOR field for that parcelable. |

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