### Question:
ShortDynamicLinkImpl extends AbstractSafeParcelable implements ShortDynamicLink { @Override public void writeToParcel(Parcel dest, int flags) { ShortDynamicLinkImplCreator.writeToParcel(this, dest, flags); } @SafeParcelable.Constructor  ShortDynamicLinkImpl(
      @Param(id = 1) Uri shortLink,
      @Param(id = 2) Uri previewLink,
      @Param(id = 3) List<WarningImpl> warnings); @Override Uri getShortLink(); @Override Uri getPreviewLink(); @Override List<WarningImpl> getWarnings(); @Override void writeToParcel(Parcel dest, int flags); static final Creator<ShortDynamicLinkImpl> CREATOR; }### Answer:
@Test public void testWriteToParcel() { List<WarningImpl> warnings = createWarningList(); ShortDynamicLinkImpl shortDynamicLink = new ShortDynamicLinkImpl(shortLink, previewLink, warnings); Parcel out = Parcel.obtain(); shortDynamicLink.writeToParcel(out, 0); out.setDataPosition(0); ShortDynamicLinkImpl parcelLink = ShortDynamicLinkImpl.CREATOR.createFromParcel(out); assertEquals(shortDynamicLink.getShortLink(), parcelLink.getShortLink()); assertEquals(shortDynamicLink.getPreviewLink(), parcelLink.getPreviewLink()); List<WarningImpl> parcelWarnings = parcelLink.getWarnings(); assertEquals(warnings.size(), parcelWarnings.size()); for (int i = 0; i < warnings.size(); ++i) { WarningImpl warning = warnings.get(i); WarningImpl parcelWarning = parcelWarnings.get(i); assertEquals(warning.getCode(), parcelWarning.getCode()); assertEquals(warning.getMessage(), parcelWarning.getMessage()); } }
@Test public void testContactMethod_WriteToParcel() { WarningImpl warning = new WarningImpl(WARNING_MESSAGE); Parcel out = Parcel.obtain(); warning.writeToParcel(out, 0); out.setDataPosition(0); WarningImpl parcelWarning = WarningImpl.CREATOR.createFromParcel(out); assertEquals(warning.getCode(), parcelWarning.getCode()); assertEquals(warning.getMessage(), parcelWarning.getMessage()); }