use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class PropertyMappingContextCustomizerFactoryTests method getContextCustomizerWhenHasAttributeMappingShouldReturnCustomizer.
@Test
public void getContextCustomizerWhenHasAttributeMappingShouldReturnCustomizer() {
ContextCustomizer customizer = this.factory.createContextCustomizer(AttributeMapping.class, null);
assertThat(customizer).isNotNull();
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class PropertyMappingContextCustomizerFactoryTests method propertyMappingShouldNotBeUsedWithComponent.
@Test
public void propertyMappingShouldNotBeUsedWithComponent() throws Exception {
ContextCustomizer customizer = this.factory.createContextCustomizer(AttributeMapping.class, null);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(ConfigMapping.class);
customizer.customizeContext(context, null);
this.thrown.expect(BeanCreationException.class);
this.thrown.expectMessage("The @PropertyMapping annotation " + "@PropertyMappingContextCustomizerFactoryTests.TypeMappingAnnotation " + "cannot be used in combination with the @Component annotation @Configuration");
context.refresh();
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class ImportsContextCustomizerFactoryTests method getContextCustomizerWhenHasMetaImportAnnotationShouldReturnCustomizer.
@Test
public void getContextCustomizerWhenHasMetaImportAnnotationShouldReturnCustomizer() {
ContextCustomizer customizer = this.factory.createContextCustomizer(TestWithMetaImport.class, null);
assertThat(customizer).isNotNull();
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class MockitoContextCustomizerFactoryTests method getContextCustomizerWithAnnotationReturnsCustomizer.
@Test
public void getContextCustomizerWithAnnotationReturnsCustomizer() throws Exception {
ContextCustomizer customizer = this.factory.createContextCustomizer(WithMockBeanAnnotation.class, null);
assertThat(customizer).isNotNull();
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class ImportsContextCustomizerFactoryTests method getContextCustomizerWhenHasNoImportAnnotationShouldReturnNull.
@Test
public void getContextCustomizerWhenHasNoImportAnnotationShouldReturnNull() {
ContextCustomizer customizer = this.factory.createContextCustomizer(TestWithNoImport.class, null);
assertThat(customizer).isNull();
}
Aggregations