LibraryInfo implements Parcelable { @Override public int hashCode() { int result = libraryId != null ? libraryId.hashCode() : 0; result = 31 * result + (libraryName != null ? libraryName.hashCode() : 0); result = 31 * result + (folderId != null ? folderId.hashCode() : 0); result = 31 * result + (folderName != null ? folderName.hashCode() : 0); return result; } LibraryInfo(@NonNull String libraryId, @Nullable String libraryName,
                       @Nullable String folderId, @Nullable String folderName); LibraryInfo buildUpon(@Nullable String newFolderId, @Nullable String newFolderName); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); final String libraryId; final String libraryName; final String folderId; final String folderName; static final Creator<LibraryInfo> CREATOR; }
@Test public void ensureLibraryInfoHashCodeWorks() { assertThat(libraryInfo1.hashCode()).isEqualTo(libraryInfo1_copy.hashCode()); assertThat(libraryInfo1.hashCode()).isNotEqualTo(libraryInfo2.hashCode()); }