private void assertGetMergedAnnotation(Class<?> element, String... expected) {
    String name = ContextConfig.class.getName();
    ContextConfig contextConfig = getMergedAnnotation(element, ContextConfig.class);

    assertNotNull("Should find @ContextConfig on " + element.getSimpleName(), contextConfig);
    assertArrayEquals("locations", expected, contextConfig.locations());
    assertArrayEquals("value", expected, contextConfig.value());
    assertArrayEquals("classes", new Class<?>[0], contextConfig.classes());

    // Verify contracts between utility methods:
    assertTrue(isAnnotated(element, name));
  }
  @Test
  public void
      findMergedAnnotationWithLocalAliasesThatConflictWithAttributesInMetaAnnotationByConvention() {
    final String[] EMPTY = new String[0];
    Class<?> element = SpringAppConfigClass.class;
    ContextConfig contextConfig = findMergedAnnotation(element, ContextConfig.class);

    assertNotNull("Should find @ContextConfig on " + element, contextConfig);
    assertArrayEquals("locations for " + element, EMPTY, contextConfig.locations());
    // 'value' in @SpringAppConfig should not override 'value' in @ContextConfig
    assertArrayEquals("value for " + element, EMPTY, contextConfig.value());
    assertArrayEquals(
        "classes for " + element, new Class<?>[] {Number.class}, contextConfig.classes());
  }
  @Test
  public void findMergedAnnotationForMultipleMetaAnnotationsWithClashingAttributeNames() {
    String[] xmlLocations = asArray("test.xml");
    String[] propFiles = asArray("test.properties");

    Class<?> element = AliasedComposedContextConfigAndTestPropSourceClass.class;

    ContextConfig contextConfig = findMergedAnnotation(element, ContextConfig.class);
    assertNotNull("@ContextConfig on " + element, contextConfig);
    assertArrayEquals("locations", xmlLocations, contextConfig.locations());
    assertArrayEquals("value", xmlLocations, contextConfig.value());

    // Synthesized annotation
    TestPropSource testPropSource = AnnotationUtils.findAnnotation(element, TestPropSource.class);
    assertArrayEquals("locations", propFiles, testPropSource.locations());
    assertArrayEquals("value", propFiles, testPropSource.value());

    // Merged annotation
    testPropSource = findMergedAnnotation(element, TestPropSource.class);
    assertNotNull("@TestPropSource on " + element, testPropSource);
    assertArrayEquals("locations", propFiles, testPropSource.locations());
    assertArrayEquals("value", propFiles, testPropSource.value());
  }