Artist implements Bundleable { @Override public int hashCode() { int result = identity != null ? identity.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + albumCount; result = 31 * result + songCount; return result; } protected  Artist(@NonNull String identity,
                     @NonNull String name,
                     int albumCount,
                     int songCount); @Override String getIdentity(); @Override String getName(); @Override Bundle toBundle(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Builder builder(); final String identity; final String name; final int albumCount; final int songCount; static final BundleCreator<Artist> BUNDLE_CREATOR; }
@Test public void ensureArtistHashCodeWorks() { assertThat(artist1.hashCode()).isEqualTo(artist1_copy.hashCode()); assertThat(artist1.hashCode()).isNotEqualTo(artist2.hashCode()); }