{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class Parcelables
Testing utilities for Parcelables.
Public functions |
|
|---|---|
T |
<T : Parcelable?> forceParcel(parcelable: T, creator: Creator<T>)Parcelables are lazily marshalled, meaning that in typical testing, no marshalling would occur and would therefore go untested. |
fun <T : Parcelable?> forceParcel(parcelable: T, creator: 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: Creator<T> |
the CREATOR field for that parcelable. |
| Returns | |
|---|---|
T |
a new instance of the parcelable that has been unmarshalled. |