@Test public void testEqualsAndHashCode() { Pet pet1 = new Pet(); Pet pet2 = new Pet(); assertTrue(pet1.equals(pet2)); assertTrue(pet2.equals(pet1)); assertTrue(pet1.hashCode() == pet2.hashCode()); assertTrue(pet1.equals(pet1)); assertTrue(pet1.hashCode() == pet1.hashCode()); pet2.setName("really-happy"); pet2.setPhotoUrls(Arrays.asList(new String[] {"http://foo.bar.com/1", "http://foo.bar.com/2"})); assertFalse(pet1.equals(pet2)); assertFalse(pet2.equals(pet1)); assertFalse(pet1.hashCode() == (pet2.hashCode())); assertTrue(pet2.equals(pet2)); assertTrue(pet2.hashCode() == pet2.hashCode()); pet1.setName("really-happy"); pet1.setPhotoUrls(Arrays.asList(new String[] {"http://foo.bar.com/1", "http://foo.bar.com/2"})); assertTrue(pet1.equals(pet2)); assertTrue(pet2.equals(pet1)); assertTrue(pet1.hashCode() == pet2.hashCode()); assertTrue(pet1.equals(pet1)); assertTrue(pet1.hashCode() == pet1.hashCode()); }