Пример #1
0
 @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());
 }
Пример #2
0
 @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());
 }
Пример #3
0
 @Test
 public void equals_same() {
   final Attribute a = new Blueprint().build();
   assertEquals(a, a);
   assertSame(a, a);
   assertTrue(a.hashCode() == a.hashCode());
 }
Пример #4
0
 @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());
 }
Пример #5
0
 @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());
 }
Пример #6
0
 @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());
 }
Пример #7
0
  @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());
  }