ChapterTocFrame extends Id3Frame { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(elementId); dest.writeByte((byte) (isRoot ? 1 : 0)); dest.writeByte((byte) (isOrdered ? 1 : 0)); dest.writeStringArray(children); dest.writeInt(subFrames.length); for (Id3Frame subFrame : subFrames) { dest.writeParcelable(subFrame, 0); } } ChapterTocFrame(String elementId, boolean isRoot, boolean isOrdered, String[] children,
      Id3Frame[] subFrames);   ChapterTocFrame(Parcel in); int getSubFrameCount(); Id3Frame getSubFrame(int index); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); @Override void writeToParcel(Parcel dest, int flags); static final String ID; final String elementId; final boolean isRoot; final boolean isOrdered; final String[] children; static final Creator<ChapterTocFrame> CREATOR; }
@Test public void testParcelable() { String[] children = new String[] {"child0", "child1"}; Id3Frame[] subFrames = new Id3Frame[] { new TextInformationFrame("TIT2", null, "title"), new UrlLinkFrame("WXXX", "description", "url") }; ChapterTocFrame chapterTocFrameToParcel = new ChapterTocFrame("id", false, true, children, subFrames); Parcel parcel = Parcel.obtain(); chapterTocFrameToParcel.writeToParcel(parcel, 0); parcel.setDataPosition(0); ChapterTocFrame chapterTocFrameFromParcel = ChapterTocFrame.CREATOR.createFromParcel(parcel); assertThat(chapterTocFrameFromParcel).isEqualTo(chapterTocFrameToParcel); parcel.recycle(); }