@Test public void twoObjectsWithSameFieldsShouldBeEqual() throws Exception { Information first = new Information("Full edition", "Access to all themes", "€ 1.00"); Information second = new Information("Full edition", "Access to all themes", "€ 1.00"); assertEquals(first, second); assertEquals(first.hashCode(), second.hashCode()); }
@Override public int hashCode() { int result = localName != null ? localName.hashCode() : 0; result = 31 * result + (localDescription != null ? localDescription.hashCode() : 0); result = 31 * result + (localPricing != null ? localPricing.hashCode() : 0); return result; }
Information { @Override public int hashCode() { int result = localName != null ? localName.hashCode() : 0; result = 31 * result + (localDescription != null ? localDescription.hashCode() : 0); result = 31 * result + (localPricing != null ? localPricing.hashCode() : 0); return result; } }
Information { @Override public int hashCode() { int result = localName != null ? localName.hashCode() : 0; result = 31 * result + (localDescription != null ? localDescription.hashCode() : 0); result = 31 * result + (localPricing != null ? localPricing.hashCode() : 0); return result; } Information(String localName, String localDescription, String localPricing); private  Information(Builder builder); }
Information { @Override public int hashCode() { int result = localName != null ? localName.hashCode() : 0; result = 31 * result + (localDescription != null ? localDescription.hashCode() : 0); result = 31 * result + (localPricing != null ? localPricing.hashCode() : 0); return result; } Information(String localName, String localDescription, String localPricing); private  Information(Builder builder); static Builder newBuilder(); @Deprecated @Nullable Integer getPriceInCents(); @Nullable FreeTrialPeriod getFreeTrialPeriod(); @Nullable Double getPriceAsDouble(); String getPriceCurrencyCode(); String getLocalName(); String getLocalDescription(); String getLocalPricing(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
Information { @Override public int hashCode() { int result = localName != null ? localName.hashCode() : 0; result = 31 * result + (localDescription != null ? localDescription.hashCode() : 0); result = 31 * result + (localPricing != null ? localPricing.hashCode() : 0); return result; } Information(String localName, String localDescription, String localPricing); private  Information(Builder builder); static Builder newBuilder(); @Deprecated @Nullable Integer getPriceInCents(); @Nullable FreeTrialPeriod getFreeTrialPeriod(); @Nullable Double getPriceAsDouble(); String getPriceCurrencyCode(); String getLocalName(); String getLocalDescription(); String getLocalPricing(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Information UNAVAILABLE; }