TestAnnotation realAnnotation) {
assertNotNull(annotatedElement);
assertNull(annotatedElement.getAnnotation(SourceRetentionAnnotation.class));
TestAnnotation testAnnotation = annotatedElement.getAnnotation(TestAnnotation.class);
assertNotNull(testAnnotation);
// Check our proxy objects against the real thing.
assertEquals(realAnnotation, testAnnotation);
assertEquals(realAnnotation.hashCode(), testAnnotation.hashCode());
// tobyr doesn't like this.
// assertEquals(realAnnotation.toString(), testAnnotation.toString());
// checks default value
assertEquals(testAnnotationValue, testAnnotation.value());
assertEquals(nestedAnnotationValue,
testAnnotation.nestedAnnotation().value());
// Tests default values using conditional statements.
assertEquals(realAnnotation.longValue(), testAnnotation.longValue());
// Tests default value of array type.
assertEquals(realAnnotation.intArrayValue().length,
testAnnotation.intArrayValue().length);
// Tests default value which is a field reference.
assertEquals(realAnnotation.stringValue(), testAnnotation.stringValue());
// Tests default value that is a class literal.
assertEquals(realAnnotation.classLiteral(), testAnnotation.classLiteral());
// Tests implicit array initializers
Class<?>[] expectedArrayValue = realAnnotation.arrayWithImplicitArrayInitializer();
Class<?>[] actualArrayValue = testAnnotation.arrayWithImplicitArrayInitializer();
assertTrue(expectedArrayValue.length > 0);
assertEquals(expectedArrayValue.length, actualArrayValue.length);
assertEquals(expectedArrayValue[0], actualArrayValue[0]);
// Tests that empty array initializers are also handled correctly.
assertEquals(realAnnotation.emptyArray().length,
testAnnotation.emptyArray().length);
}