|
|
@ -18,13 +18,13 @@ package org.springframework.boot.autoconfigure.validation;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.Validator;
|
|
|
|
import javax.validation.Validator;
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.After;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
|
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
|
|
|
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
|
|
|
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
|
|
|
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
|
|
|
|
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
|
|
|
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
@ -39,20 +39,15 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
@ClassPathExclusions({ "tomcat-embed-el-*.jar", "el-api-*.jar" })
|
|
|
|
@ClassPathExclusions({ "tomcat-embed-el-*.jar", "el-api-*.jar" })
|
|
|
|
public class ValidationAutoConfigurationWithHibernateValidatorMissingElImplTests {
|
|
|
|
public class ValidationAutoConfigurationWithHibernateValidatorMissingElImplTests {
|
|
|
|
|
|
|
|
|
|
|
|
private AnnotationConfigApplicationContext context;
|
|
|
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
|
|
|
|
|
|
|
.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.class));
|
|
|
|
@After
|
|
|
|
|
|
|
|
public void close() {
|
|
|
|
|
|
|
|
if (this.context != null) {
|
|
|
|
|
|
|
|
this.context.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void missingElDependencyIsTolerated() {
|
|
|
|
public void missingElDependencyIsTolerated() {
|
|
|
|
this.context = new AnnotationConfigApplicationContext(ValidationAutoConfiguration.class);
|
|
|
|
this.contextRunner.run((context) -> {
|
|
|
|
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
|
|
|
|
assertThat(context).hasSingleBean(Validator.class);
|
|
|
|
assertThat(this.context.getBeansOfType(MethodValidationPostProcessor.class)).hasSize(1);
|
|
|
|
assertThat(context).hasSingleBean(MethodValidationPostProcessor.class);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|