GuidanceStreetLabelData implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(mCurrentStreet); dest.writeInt(mBackgroundColor); } GuidanceStreetLabelData(String currentStreet, int backgroundColor);   GuidanceStreetLabelData(Parcel in); String getCurrentStreetName(); int getBackgroundColor(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final Creator<GuidanceStreetLabelData> CREATOR; }
@Test public void testWriteToParcel() { Parcel parcel = Parcel.obtain(); mCurrentStreetData.writeToParcel(parcel, mCurrentStreetData.describeContents()); parcel.setDataPosition(0); GuidanceStreetLabelData fromParcel = GuidanceStreetLabelData.CREATOR.createFromParcel(parcel); assertEquals(NAME, fromParcel.getCurrentStreetName()); assertEquals(COLOR, fromParcel.getBackgroundColor()); }