@Test public void testHashCode() { assertThat(category.hashCode()).isEqualTo(new FromCategory().hashCode()); assertThat(category.hashCode()).isEqualTo(category.hashCode()); assertThat(category.hashCode()).isEqualTo(new ForeNameCategory().hashCode()); category.setFilter(new DateEquals()); final FromCategory other = new FromCategory(); other.setFilter(new DateEquals()); assertThat(category.hashCode()).isEqualTo(other.hashCode()); final ForeNameCategory different = new ForeNameCategory(); different.setFilter(new StringEquals()); assertThat(category.hashCode()).isEqualTo(different.hashCode()); }
@Test public void testEquals() { assertThat(category).isEqualTo(new FromCategory()); assertThat(category).isEqualTo(category); assertThat(category).isNotEqualTo(null); assertThat(category).isNotEqualTo(new ForeNameCategory()); assertThat(category).isNotEqualTo("category"); category.setFilter(new DateEquals()); final FromCategory other = new FromCategory(); assertThat(category).isNotEqualTo(other); assertThat(other).isNotEqualTo(category); other.setFilter(new DateEquals()); assertThat(category).isEqualTo(other); final ForeNameCategory different = new ForeNameCategory(); different.setFilter(new StringEquals()); category.getFilter().setFilterValue(new Date()); assertThat(category).isNotEqualTo(different); assertThat(different).isNotEqualTo(category); }