|
|
|
|
@ -25,6 +25,7 @@ import org.springframework.boot.diagnostics.FailureAnalysis;
@@ -25,6 +25,7 @@ import org.springframework.boot.diagnostics.FailureAnalysis;
|
|
|
|
|
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions; |
|
|
|
|
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; |
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.junit.Assert.fail; |
|
|
|
|
@ -39,7 +40,7 @@ import static org.junit.Assert.fail;
@@ -39,7 +40,7 @@ import static org.junit.Assert.fail;
|
|
|
|
|
public class ValidationExceptionFailureAnalyzerTests { |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void test() { |
|
|
|
|
public void validatedPropertiesTest() { |
|
|
|
|
try { |
|
|
|
|
new AnnotationConfigApplicationContext(TestConfiguration.class).close(); |
|
|
|
|
fail("Expected failure did not occur"); |
|
|
|
|
@ -51,6 +52,11 @@ public class ValidationExceptionFailureAnalyzerTests {
@@ -51,6 +52,11 @@ public class ValidationExceptionFailureAnalyzerTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void nonValidatedPropertiesTest() { |
|
|
|
|
new AnnotationConfigApplicationContext(NonValidatedTestConfiguration.class).close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@EnableConfigurationProperties(TestProperties.class) |
|
|
|
|
static class TestConfiguration { |
|
|
|
|
|
|
|
|
|
@ -60,8 +66,22 @@ public class ValidationExceptionFailureAnalyzerTests {
@@ -60,8 +66,22 @@ public class ValidationExceptionFailureAnalyzerTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ConfigurationProperties("test") |
|
|
|
|
@Validated |
|
|
|
|
private static class TestProperties { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EnableConfigurationProperties(NonValidatedTestProperties.class) |
|
|
|
|
static class NonValidatedTestConfiguration { |
|
|
|
|
|
|
|
|
|
NonValidatedTestConfiguration(NonValidatedTestProperties testProperties) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ConfigurationProperties("test") |
|
|
|
|
private static class NonValidatedTestProperties { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|