|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2022 the original author or authors. |
| 2 | + * Copyright 2012-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
21 | 21 | import org.junit.jupiter.api.extension.ExtendWith;
|
22 | 22 |
|
23 | 23 | import org.springframework.beans.factory.BeanFactory;
|
24 |
| -import org.springframework.boot.testsupport.system.CapturedOutput; |
25 | 24 | import org.springframework.boot.testsupport.system.OutputCaptureExtension;
|
26 | 25 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
27 | 26 | import org.springframework.core.env.Environment;
|
@@ -52,19 +51,24 @@ void configureMock() {
|
52 | 51 | }
|
53 | 52 |
|
54 | 53 | @Test
|
55 |
| - void analyzerIsConstructedWithBeanFactory(CapturedOutput output) { |
| 54 | + void analyzersAreLoadedAndCalled() { |
| 55 | + RuntimeException failure = new RuntimeException(); |
| 56 | + analyzeAndReport(failure, BasicFailureAnalyzer.class, BasicFailureAnalyzer.class); |
| 57 | + then(failureAnalyzer).should(times(2)).analyze(failure); |
| 58 | + } |
| 59 | + |
| 60 | + @Test |
| 61 | + void analyzerIsConstructedWithBeanFactory() { |
56 | 62 | RuntimeException failure = new RuntimeException();
|
57 | 63 | analyzeAndReport(failure, BasicFailureAnalyzer.class, BeanFactoryConstructorFailureAnalyzer.class);
|
58 | 64 | then(failureAnalyzer).should(times(2)).analyze(failure);
|
59 |
| - assertThat(output).doesNotContain("implement BeanFactoryAware or EnvironmentAware"); |
60 | 65 | }
|
61 | 66 |
|
62 | 67 | @Test
|
63 |
| - void analyzerIsConstructedWithEnvironment(CapturedOutput output) { |
| 68 | + void analyzerIsConstructedWithEnvironment() { |
64 | 69 | RuntimeException failure = new RuntimeException();
|
65 | 70 | analyzeAndReport(failure, BasicFailureAnalyzer.class, EnvironmentConstructorFailureAnalyzer.class);
|
66 | 71 | then(failureAnalyzer).should(times(2)).analyze(failure);
|
67 |
| - assertThat(output).doesNotContain("implement BeanFactoryAware or EnvironmentAware"); |
68 | 72 | }
|
69 | 73 |
|
70 | 74 | @Test
|
|
0 commit comments