MangaLibraryUpdate implements Parcelable { public void setPrivacy(final Privacy privacy) { if (Privacy.PRIVATE == privacy) { mIsPrivate = true; } else if (Privacy.PUBLIC == privacy) { mIsPrivate = false; } else { throw new IllegalArgumentException("privacy is an illegal value: " + privacy); } } MangaLibraryUpdate(final MangaDigest digest);  MangaLibraryUpdate(final MangaLibraryEntry libraryEntry); private  MangaLibraryUpdate(final Parcel source); boolean containsModifications(); int getChaptersRead(); Defaults getDefaults(); String getMangaId(); String getMangaTitle(); @Nullable String getNotes(); @Nullable Rating getRating(); @Nullable ReadingStatus getReadingStatus(); int getReReadCount(); int getVolumesRead(); boolean isPrivate(); boolean isReReading(); void setChaptersRead(final int chaptersRead); void setNotes(@Nullable String notes); void setPrivacy(final Privacy privacy); void setRating(@Nullable final Rating rating); void setReadingStatus(@Nullable final ReadingStatus readingStatus); void setReReadCount(final int reReadCount); void setReReading(final boolean reReading); void setVolumesRead(final int volumesRead); JsonObject toJson(); @Override int describeContents(); @Override void writeToParcel(final Parcel dest, final int flags); static final Creator<MangaLibraryUpdate> CREATOR; }
@Test public void testSetPrivacy() throws Exception { assertFalse(mLibraryUpdate.containsModifications()); mLibraryUpdate.setPrivacy(mLibraryUpdate.getDefaults().isPrivate() ? Privacy.PRIVATE : Privacy.PUBLIC); assertFalse(mLibraryUpdate.containsModifications()); mLibraryUpdate.setPrivacy(mLibraryUpdate.isPrivate() ? Privacy.PUBLIC : Privacy.PRIVATE); assertTrue(mLibraryUpdate.containsModifications()); mLibraryUpdate.setPrivacy(mLibraryUpdate.getDefaults().isPrivate() ? Privacy.PRIVATE : Privacy.PUBLIC); assertFalse(mLibraryUpdate.containsModifications()); }