use of cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory in project today-infrastructure by TAKETODAY.
the class AnnotationMetadataTests method composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor.
@Test
// SPR-11649
void composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor() throws Exception {
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(NamedComposedAnnotationClass.class.getName());
AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
assertMultipleAnnotationsWithIdenticalAttributeNames(metadata);
}
use of cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory in project today-infrastructure by TAKETODAY.
the class AspectJTypeFilterTests method assertMatch.
private void assertMatch(String type, String typePattern) throws Exception {
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(type);
AspectJTypeFilter filter = new AspectJTypeFilter(typePattern, getClass().getClassLoader());
assertThat(filter.match(metadataReader, metadataReaderFactory)).isTrue();
ClassloadingAssertions.assertClassNotLoaded(type);
}
use of cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory in project today-infrastructure by TAKETODAY.
the class AnnotationTypeFilterTests method inheritedAnnotationFromInterfaceDoesNotMatch.
@Test
void inheritedAnnotationFromInterfaceDoesNotMatch() throws Exception {
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
String classUnderTest = "type.AnnotationTypeFilterTestsTypes$SomeClassWithSomeComponentInterface";
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);
AnnotationTypeFilter filter = new AnnotationTypeFilter(InheritedAnnotation.class);
// Must fail as annotation on interfaces should not be considered a match
assertThat(filter.match(metadataReader, metadataReaderFactory)).isFalse();
ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
}
use of cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory in project today-infrastructure by TAKETODAY.
the class AnnotationTypeFilterTests method nonInheritedAnnotationDoesNotMatch.
@Test
void nonInheritedAnnotationDoesNotMatch() throws Exception {
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
String classUnderTest = "type.AnnotationTypeFilterTestsTypes$SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation";
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);
AnnotationTypeFilter filter = new AnnotationTypeFilter(NonInheritedAnnotation.class);
// Must fail as annotation isn't inherited
assertThat(filter.match(metadataReader, metadataReaderFactory)).isFalse();
ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
}
use of cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory in project today-infrastructure by TAKETODAY.
the class AnnotationTypeFilterTests method inheritedAnnotationFromBaseClassDoesMatch.
@Test
void inheritedAnnotationFromBaseClassDoesMatch() throws Exception {
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
String classUnderTest = "type.AnnotationTypeFilterTestsTypes$SomeSubclassOfSomeComponent";
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(classUnderTest);
AnnotationTypeFilter filter = new AnnotationTypeFilter(InheritedAnnotation.class);
assertThat(filter.match(metadataReader, metadataReaderFactory)).isTrue();
ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
}
Aggregations