@Test public void equals_different_FINAL() { final Attribute a = new Blueprint().final1(Final.FINAL).build(); final Attribute b = new Blueprint().final1(Final.UNDEFINED).build(); assertFalse(a.equals(b)); assertFalse(a.hashCode() == b.hashCode()); }
@Test public void equals_different_NAME() { final Attribute a = new Blueprint().name("test1").build(); final Attribute b = new Blueprint().name("test2").build(); assertFalse(a.equals(b)); assertFalse(a.hashCode() == b.hashCode()); }
@Test public void equals_same() { final Attribute a = new Blueprint().build(); assertEquals(a, a); assertSame(a, a); assertTrue(a.hashCode() == a.hashCode()); }
@Test public void equals_identical() { final Attribute a = new Blueprint().build(); final Attribute b = new Blueprint().build(); assertEquals(a, b); assertTrue(a.hashCode() == b.hashCode()); }
@Test public void equals_different_TYPE() { final Attribute a = new Blueprint().type(Type.of(String.class)).build(); final Attribute b = new Blueprint().type(Type.of(Integer.class)).build(); assertFalse(a.equals(b)); assertFalse(a.hashCode() == b.hashCode()); }
@Test public void equals_different_ANNOTATIONS() { final Attribute a = new Blueprint().annotations(Lists.newArrayList(Annotation.of(Nonnull.class))).build(); final Attribute b = new Blueprint().annotations(Lists.newArrayList(Annotation.of(Nullable.class))).build(); assertFalse(a.equals(b)); assertFalse(a.hashCode() == b.hashCode()); }
@Test public void testHashcode() throws Exception { // given final Attribute<?> attribute = newSetterAttribute(getSetter(new PrivateTarget())); final Attribute<?> other = newSetterAttribute(getSetter(new PrivateTarget())); // then assertEquals(attribute.hashCode(), other.hashCode()); }