ArtInfo implements Parcelable, Comparable<ArtInfo> { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(artistName); dest.writeString(albumName); artworkUri.writeToParcel(dest, flags); dest.writeInt(forArtist ? 1 : 0); } @Deprecated  ArtInfo(String artistName, String albumName, Uri artworkUri); private  ArtInfo(String artistName, String albumName, Uri artworkUri, boolean forArtist); static ArtInfo forAlbum(String artistName, String albumName, Uri artworkUri); static ArtInfo forArtist(String artistName, Uri artworkUri); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); String cacheKey(); Uri asContentUri(String authority); Uri asUri(Uri base); static ArtInfo fromUri(Uri uri); @Override int compareTo(ArtInfo another); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final ArtInfo NULLINSTANCE; final String artistName; final String albumName; final Uri artworkUri; final boolean forArtist; static final Creator<ArtInfo> CREATOR; }
@Test public void ensureArtInfoParcelableWorks() { Parcel p = Parcel.obtain(); artInfo1.writeToParcel(p, 0); p.setDataPosition(0); ArtInfo fromP = ArtInfo.CREATOR.createFromParcel(p); assertThat(artInfo1).isEqualTo(fromP); }