PluginInfo implements Parcelable, Comparable<PluginInfo> { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(title.toString()); dest.writeString(description.toString()); dest.writeString(componentName.flattenToString()); } PluginInfo(CharSequence title, CharSequence description, ComponentName componentName); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Override int compareTo(@NonNull PluginInfo another); final CharSequence title; final CharSequence description; final ComponentName componentName; transient Drawable icon; transient boolean isActive; public boolean hasPermission; static final Creator<PluginInfo> CREATOR; }
@Test public void ensurePluginInfoParcelableWorks() { Parcel p = Parcel.obtain(); pluginInfo1.writeToParcel(p, 0); p.setDataPosition(0); PluginInfo fromP = PluginInfo.CREATOR.createFromParcel(p); assertThat(pluginInfo1).isEqualTo(fromP); }