use of org.springframework.test.context.ContextCustomizer in project spring-framework by spring-projects.
the class AbstractTestContextBootstrapper method getContextCustomizers.
private Set<ContextCustomizer> getContextCustomizers(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes) {
List<ContextCustomizerFactory> factories = getContextCustomizerFactories();
Set<ContextCustomizer> customizers = new LinkedHashSet<>(factories.size());
for (ContextCustomizerFactory factory : factories) {
ContextCustomizer customizer = factory.createContextCustomizer(testClass, configAttributes);
if (customizer != null) {
customizers.add(customizer);
}
}
return customizers;
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class OverrideAutoConfigurationContextCustomizerFactoryTests method getContextCustomizerWhenHasAnnotationEnabledTrueShouldReturnNull.
@Test
public void getContextCustomizerWhenHasAnnotationEnabledTrueShouldReturnNull() throws Exception {
ContextCustomizer customizer = this.factory.createContextCustomizer(WithAnnotationEnabledTrue.class, null);
assertThat(customizer).isNull();
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class OverrideAutoConfigurationContextCustomizerFactoryTests method getContextCustomizerWhenHasAnnotationEnabledFalseShouldReturnCustomizer.
@Test
public void getContextCustomizerWhenHasAnnotationEnabledFalseShouldReturnCustomizer() throws Exception {
ContextCustomizer customizer = this.factory.createContextCustomizer(WithAnnotationEnabledFalse.class, null);
assertThat(customizer).isNotNull();
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class OverrideAutoConfigurationContextCustomizerFactoryTests method hashCodeAndEquals.
@Test
public void hashCodeAndEquals() throws Exception {
ContextCustomizer customizer1 = this.factory.createContextCustomizer(WithAnnotationEnabledFalse.class, null);
ContextCustomizer customizer2 = this.factory.createContextCustomizer(WithSameAnnotation.class, null);
assertThat(customizer1.hashCode()).isEqualTo(customizer2.hashCode());
assertThat(customizer1).isEqualTo(customizer1).isEqualTo(customizer2);
}
use of org.springframework.test.context.ContextCustomizer in project spring-boot by spring-projects.
the class PropertyMappingContextCustomizerFactoryTests method hashCodeAndEqualsShouldBeBasedOnPropertyValues.
@Test
public void hashCodeAndEqualsShouldBeBasedOnPropertyValues() throws Exception {
ContextCustomizer customizer1 = this.factory.createContextCustomizer(TypeMapping.class, null);
ContextCustomizer customizer2 = this.factory.createContextCustomizer(AttributeMapping.class, null);
ContextCustomizer customizer3 = this.factory.createContextCustomizer(OtherMapping.class, null);
assertThat(customizer1.hashCode()).isEqualTo(customizer2.hashCode());
assertThat(customizer1).isEqualTo(customizer1).isEqualTo(customizer2).isNotEqualTo(customizer3);
}
Aggregations