@Test public void testEquals() { Category c1 = new Category(1, 1, "Programmming"); Category c2 = new Category(1, 1, "Programmming"); Category c3 = new Category(1, 1, "Prog"); Category c4 = new Category(1, 2, "Programmming"); Category d1 = new Category(2, 1, "Programmming"); assertThat(c1, is(c2)); assertThat(c1, is(not(c3))); assertThat(c1, is(not(c4))); assertThat(c1, is(not(d1))); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Category other = (Category) obj; if (categoryName == null) { if (other.categoryName != null) return false; } else if (!categoryName.equals(other.categoryName)) return false; if (categoryPK == null) { if (other.categoryPK != null) return false; } else if (!categoryPK.equals(other.categoryPK)) return false; return true; }
Category implements Comparable<Category>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Category other = (Category) obj; if (categoryName == null) { if (other.categoryName != null) return false; } else if (!categoryName.equals(other.categoryName)) return false; if (categoryPK == null) { if (other.categoryPK != null) return false; } else if (!categoryPK.equals(other.categoryPK)) return false; return true; } }
Category implements Comparable<Category>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Category other = (Category) obj; if (categoryName == null) { if (other.categoryName != null) return false; } else if (!categoryName.equals(other.categoryName)) return false; if (categoryPK == null) { if (other.categoryPK != null) return false; } else if (!categoryPK.equals(other.categoryPK)) return false; return true; } Category(Integer entryId, Integer categoryOrder, String categoryName); }
Category implements Comparable<Category>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Category other = (Category) obj; if (categoryName == null) { if (other.categoryName != null) return false; } else if (!categoryName.equals(other.categoryName)) return false; if (categoryPK == null) { if (other.categoryPK != null) return false; } else if (!categoryPK.equals(other.categoryPK)) return false; return true; } Category(Integer entryId, Integer categoryOrder, String categoryName); @Override int compareTo(Category o); @Override boolean equals(Object obj); @Override int hashCode(); }
Category implements Comparable<Category>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Category other = (Category) obj; if (categoryName == null) { if (other.categoryName != null) return false; } else if (!categoryName.equals(other.categoryName)) return false; if (categoryPK == null) { if (other.categoryPK != null) return false; } else if (!categoryPK.equals(other.categoryPK)) return false; return true; } Category(Integer entryId, Integer categoryOrder, String categoryName); @Override int compareTo(Category o); @Override boolean equals(Object obj); @Override int hashCode();  }