RideParameters implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeByte((byte) (isPickupMyLocation ? 1 : 0)); dest.writeString(productId); dest.writeSerializable(pickupLatitude); dest.writeSerializable(pickupLongitude); dest.writeString(pickupNickname); dest.writeString(pickupAddress); dest.writeSerializable(dropoffLatitude); dest.writeSerializable(dropoffLongitude); dest.writeString(dropoffNickname); dest.writeString(dropoffAddress); dest.writeString(userAgent); } protected  RideParameters(Parcel in); private  RideParameters(boolean isPickupMyLocation,
            @Nullable String productId,
            @Nullable Double pickupLatitude,
            @Nullable Double pickupLongitude,
            @Nullable String pickupNickname,
            @Nullable String pickupAddress,
            @Nullable Double dropoffLatitude,
            @Nullable Double dropoffLongitude,
            @Nullable String dropoffNickname,
            @Nullable String dropoffAddress); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); boolean isPickupMyLocation(); @Nullable String getProductId(); @Nullable Double getPickupLatitude(); @Nullable Double getPickupLongitude(); @Nullable String getPickupNickname(); @Nullable String getPickupAddress(); @Nullable Double getDropoffLatitude(); @Nullable Double getDropoffLongitude(); @Nullable String getDropoffNickname(); @Nullable String getDropoffAddress(); static final Creator<RideParameters> CREATOR; }
@Test public void writeToParcelAndCreateFromParcel_withDefaults_shouldWork() { Parcel parcel = Parcel.obtain(); RideParameters rideParameters = new RideParameters.Builder().build(); rideParameters.writeToParcel(parcel, 0); parcel.setDataPosition(0); RideParameters rideParametersFromParcel = new RideParameters(parcel); assertDefaults(rideParametersFromParcel); }