lightbulb_outline Please take our October 2018 developer survey. Start survey

Parcelables

public final class Parcelables
extends Object

java.lang.Object
   ↳ androidx.test.core.os.Parcelables


Testing utilities for Parcelables.

Summary

Public methods

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

Parcelables are lazily marshalled, meaning that in typical testing, no marshalling would occur and would therefore go untested.

Inherited methods

From class java.lang.Object

Public methods

forceParcel

T forceParcel (T 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
parcelable T: the parcelable to marshall.

creator Creator: the CREATOR field for that parcelable.

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