@Test public void testEquals() { assertEqualsContract( Page.fromText(TITLE, TEXT), Page.fromText(TITLE, TEXT), Page.fromText(TITLE, TEXT), Page.fromText(TITLE, "bleh")); }
@Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { Page other = (Page) o; return new EqualsBuilder() .append(parentPagePath, other.parentPagePath) .append(title, other.title) .append(data, other.data) .append(contentType, other.contentType) .append(tags, other.tags) .append(viewRestrictionRole, other.viewRestrictionRole) .isEquals(); } return false; }
Page { @Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { Page other = (Page) o; return new EqualsBuilder() .append(parentPagePath, other.parentPagePath) .append(title, other.title) .append(data, other.data) .append(contentType, other.contentType) .append(tags, other.tags) .append(viewRestrictionRole, other.viewRestrictionRole) .isEquals(); } return false; } }
Page { @Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { Page other = (Page) o; return new EqualsBuilder() .append(parentPagePath, other.parentPagePath) .append(title, other.title) .append(data, other.data) .append(contentType, other.contentType) .append(tags, other.tags) .append(viewRestrictionRole, other.viewRestrictionRole) .isEquals(); } return false; } Page(String title, String contentType, PageData data); }
Page { @Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { Page other = (Page) o; return new EqualsBuilder() .append(parentPagePath, other.parentPagePath) .append(title, other.title) .append(data, other.data) .append(contentType, other.contentType) .append(tags, other.tags) .append(viewRestrictionRole, other.viewRestrictionRole) .isEquals(); } return false; } Page(String title, String contentType, PageData data); static Page fromText(String title, String text); static Page fromData(byte[] data, String contentType); static Page fromMeta(String title, String contentType); void setViewRestrictionRole(String viewRestrictionRole); @Override boolean equals(Object o); @Override int hashCode(); }
Page { @Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { Page other = (Page) o; return new EqualsBuilder() .append(parentPagePath, other.parentPagePath) .append(title, other.title) .append(data, other.data) .append(contentType, other.contentType) .append(tags, other.tags) .append(viewRestrictionRole, other.viewRestrictionRole) .isEquals(); } return false; } Page(String title, String contentType, PageData data); static Page fromText(String title, String text); static Page fromData(byte[] data, String contentType); static Page fromMeta(String title, String contentType); void setViewRestrictionRole(String viewRestrictionRole); @Override boolean equals(Object o); @Override int hashCode();  }