@Test
  public void testAnnotationEquality() {
    HashSet<TransactionalLock> annotations = new HashSet<>();

    int annotationsFound = 0;
    Method[] methods = getClass().getDeclaredMethods();
    for (Method method : methods) {
      TransactionalLock annotation = method.getAnnotation(TransactionalLock.class);
      if (null != annotation) {
        annotations.add(annotation);
        annotationsFound++;
      }
    }

    // there should be 3 discovered annotations, but only 2 in the hashset since
    // they were collapsed
    Assert.assertEquals(2, annotations.size());
    Assert.assertEquals(3, annotationsFound);
  }
Tests that annotations are actually equal (more of a proof of the javadoc
than anything).
ambari-server/src/test/java/org/apache/ambari/annotations/TransactionalLockTest.java