Search in sources :

Example 11 with Component

use of org.springframework.core.testfixture.stereotype.Component in project spring-framework by spring-projects.

the class AnnotationUtilsTests method findClassAnnotationFavorsMoreLocallyDeclaredComposedAnnotationsOverAnnotationsOnInterfaces.

// @since 4.1.2
@Test
void findClassAnnotationFavorsMoreLocallyDeclaredComposedAnnotationsOverAnnotationsOnInterfaces() {
    Component component = findAnnotation(ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface.class, Component.class);
    assertThat(component).isNotNull();
    assertThat(component.value()).isEqualTo("meta2");
}
Also used : Component(org.springframework.core.testfixture.stereotype.Component) Test(org.junit.jupiter.api.Test)

Example 12 with Component

use of org.springframework.core.testfixture.stereotype.Component in project spring-framework by spring-projects.

the class AnnotationUtilsTests method findClassAnnotationOnMetaCycleAnnotatedClassWithMissingTargetMetaAnnotation.

@Test
void findClassAnnotationOnMetaCycleAnnotatedClassWithMissingTargetMetaAnnotation() {
    Component component = findAnnotation(MetaCycleAnnotatedClass.class, Component.class);
    assertThat(component).as("Should not find @Component on MetaCycleAnnotatedClass").isNull();
}
Also used : Component(org.springframework.core.testfixture.stereotype.Component) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)12 Component (org.springframework.core.testfixture.stereotype.Component)12 AnnotationUtils.getAnnotationAttributes (org.springframework.core.annotation.AnnotationUtils.getAnnotationAttributes)2