use of org.springframework.core.type.AnnotationMetadata in project spring-boot by spring-projects.
the class ImportAutoConfigurationImportSelectorTests method exclusionsWithoutImport.
@Test
public void exclusionsWithoutImport() throws Exception {
AnnotationMetadata annotationMetadata = getAnnotationMetadata(ExclusionWithoutImport.class);
String[] imports = this.importSelector.selectImports(annotationMetadata);
assertThat(imports).containsOnly(FreeMarkerAutoConfiguration.class.getName());
}
use of org.springframework.core.type.AnnotationMetadata in project spring-boot by spring-projects.
the class ImportAutoConfigurationImportSelectorTests method importsAreSelected.
@Test
public void importsAreSelected() throws Exception {
AnnotationMetadata annotationMetadata = getAnnotationMetadata(ImportFreeMarker.class);
String[] imports = this.importSelector.selectImports(annotationMetadata);
assertThat(imports).containsExactly(FreeMarkerAutoConfiguration.class.getName());
}
use of org.springframework.core.type.AnnotationMetadata in project spring-boot by spring-projects.
the class ImportAutoConfigurationImportSelectorTests method multipleImportsAreFound.
@Test
public void multipleImportsAreFound() throws Exception {
AnnotationMetadata annotationMetadata = getAnnotationMetadata(MultipleImports.class);
String[] imports = this.importSelector.selectImports(annotationMetadata);
assertThat(imports).containsOnly(FreeMarkerAutoConfiguration.class.getName(), ThymeleafAutoConfiguration.class.getName());
}
use of org.springframework.core.type.AnnotationMetadata in project spring-boot by spring-projects.
the class ImportAutoConfigurationImportSelectorTests method exclusionsAliasesAreApplied.
@Test
public void exclusionsAliasesAreApplied() throws Exception {
AnnotationMetadata annotationMetadata = getAnnotationMetadata(ImportWithSelfAnnotatingAnnotationExclude.class);
String[] imports = this.importSelector.selectImports(annotationMetadata);
assertThat(imports).isEmpty();
}
use of org.springframework.core.type.AnnotationMetadata in project spring-boot by spring-projects.
the class AbstractConfigurationClassTests method allBeanMethodsArePublic.
@Test
public void allBeanMethodsArePublic() throws IOException, ClassNotFoundException {
Set<String> nonPublicBeanMethods = new HashSet<>();
for (AnnotationMetadata configurationClass : findConfigurationClasses()) {
Set<MethodMetadata> beanMethods = configurationClass.getAnnotatedMethods(Bean.class.getName());
for (MethodMetadata methodMetadata : beanMethods) {
if (!isPublic(methodMetadata)) {
nonPublicBeanMethods.add(methodMetadata.getDeclaringClassName() + "." + methodMetadata.getMethodName());
}
}
}
assertThat(nonPublicBeanMethods).as("Found non-public @Bean methods").isEmpty();
}
Aggregations