2525import com .netflix .discovery .shared .transport .EurekaHttpClient ;
2626import com .netflix .discovery .shared .transport .EurekaHttpResponse ;
2727import org .apache .catalina .webresources .TomcatURLStreamHandlerFactory ;
28- import org .junit .Rule ;
29- import org .junit .Test ;
30- import org .junit .runner .RunWith ;
28+ import org .junit .jupiter .api .Test ;
29+ import org .junit .jupiter .api .extension .ExtendWith ;
3130
3231import org .springframework .boot .SpringBootConfiguration ;
3332import org .springframework .boot .autoconfigure .AutoConfigurations ;
3433import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
3534import org .springframework .boot .builder .SpringApplicationBuilder ;
3635import org .springframework .boot .test .context .assertj .AssertableApplicationContext ;
3736import org .springframework .boot .test .context .runner .ApplicationContextRunner ;
38- import org .springframework .boot .test .system .OutputCaptureRule ;
37+ import org .springframework .boot .test .system .CapturedOutput ;
38+ import org .springframework .boot .test .system .OutputCaptureExtension ;
3939import org .springframework .cloud .config .client .ConfigServerInstanceProvider ;
4040import org .springframework .cloud .netflix .eureka .CloudEurekaClient ;
4141import org .springframework .cloud .netflix .eureka .EurekaClientConfigBean ;
4242import org .springframework .cloud .netflix .eureka .http .RestClientEurekaHttpClient ;
4343import org .springframework .cloud .test .ClassPathExclusions ;
44- import org .springframework .cloud .test .ModifiedClassPathRunner ;
4544import org .springframework .context .annotation .Bean ;
4645import org .springframework .context .annotation .Configuration ;
4746
5453 * @author Tang Xiong
5554 */
5655@ SuppressWarnings ("removal" )
57- @ RunWith ( ModifiedClassPathRunner .class )
56+ @ ExtendWith ( OutputCaptureExtension .class )
5857@ ClassPathExclusions ("spring-webflux-*" )
59- public class EurekaConfigServerBootstrapConfigurationTests {
60-
61- @ Rule
62- public OutputCaptureRule output = new OutputCaptureRule ();
58+ class EurekaConfigServerBootstrapConfigurationTests {
6359
6460 @ Test
65- public void offByDefault () {
61+ void offByDefault () {
6662 new ApplicationContextRunner ()
6763 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
6864 .run (this ::assertEurekaBeansNotPresent );
6965 }
7066
7167 @ Test
72- public void properBeansCreatedWhenDiscoveryEnabled () {
68+ void properBeansCreatedWhenDiscoveryEnabled () {
7369 new ApplicationContextRunner ()
7470 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
7571 .withPropertyValues ("spring.cloud.config.discovery.enabled=true" )
7672 .run (this ::assertEurekaBeansPresent );
7773 }
7874
7975 @ Test
80- public void beansNotCreatedWhenDiscoveryNotEnabled () {
76+ void beansNotCreatedWhenDiscoveryNotEnabled () {
8177 new ApplicationContextRunner ()
8278 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
8379 .withPropertyValues ("spring.cloud.config.discovery.enabled=false" )
8480 .run (this ::assertEurekaBeansNotPresent );
8581 }
8682
8783 @ Test
88- public void beansNotCreatedWhenDiscoveryDisabled () {
84+ void beansNotCreatedWhenDiscoveryDisabled () {
8985 new ApplicationContextRunner ()
9086 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
9187 .withPropertyValues ("spring.cloud.config.discovery.disabled" )
9288 .run (this ::assertEurekaBeansNotPresent );
9389 }
9490
9591 @ Test
96- public void beansNotCreatedWhenEurekaClientEnabled () {
92+ void beansNotCreatedWhenEurekaClientEnabled () {
9793 new ApplicationContextRunner ()
9894 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
9995 .withPropertyValues ("eureka.client.enabled=true" )
10096 .run (this ::assertEurekaBeansNotPresent );
10197 }
10298
10399 @ Test
104- public void beansNotCreatedWhenEurekaClientNotEnabled () {
100+ void beansNotCreatedWhenEurekaClientNotEnabled () {
105101 new ApplicationContextRunner ()
106102 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
107103 .withPropertyValues ("eureka.client.enabled=false" )
108104 .run (this ::assertEurekaBeansNotPresent );
109105 }
110106
111107 @ Test
112- public void beansNotCreatedWhenEurekaClientDisabled () {
108+ void beansNotCreatedWhenEurekaClientDisabled () {
113109 new ApplicationContextRunner ()
114110 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
115111 .withPropertyValues ("eureka.client.disabled" )
116112 .run (this ::assertEurekaBeansNotPresent );
117113 }
118114
119115 @ Test
120- public void properBeansCreatedWhenDiscoveryEnabled_EurekaEnabled () {
116+ void properBeansCreatedWhenDiscoveryEnabled_EurekaEnabled () {
121117 new ApplicationContextRunner ()
122118 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
123119 .withPropertyValues ("spring.cloud.config.discovery.enabled=true" , "eureka.client.enabled=true" )
124120 .run (this ::assertEurekaBeansPresent );
125121 }
126122
127123 @ Test
128- public void beansNotCreatedWhenDiscoveryEnabled_EurekaNotEnabled () {
124+ void beansNotCreatedWhenDiscoveryEnabled_EurekaNotEnabled () {
129125 new ApplicationContextRunner ()
130126 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
131127 .withPropertyValues ("spring.cloud.config.discovery.enabled=true" , "eureka.client.enabled=false" )
132128 .run (this ::assertEurekaBeansNotPresent );
133129 }
134130
135131 @ Test
136- public void beansNotCreatedWhenDiscoveryNotEnabled_EurekaEnabled () {
132+ void beansNotCreatedWhenDiscoveryNotEnabled_EurekaEnabled () {
137133 new ApplicationContextRunner ()
138134 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
139135 .withPropertyValues ("spring.cloud.config.discovery.enabled=false" , "eureka.client.enabled=true" )
140136 .run (this ::assertEurekaBeansNotPresent );
141137 }
142138
143139 @ Test
144- public void beansNotCreatedWhenDiscoveryNotEnabled_EurekaNotEnabled () {
140+ void beansNotCreatedWhenDiscoveryNotEnabled_EurekaNotEnabled () {
145141 new ApplicationContextRunner ()
146142 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
147143 .withPropertyValues ("spring.cloud.config.discovery.enabled=false" , "eureka.client.enabled=false" )
148144 .run (this ::assertEurekaBeansNotPresent );
149145 }
150146
151147 @ Test
152- public void eurekaDnsConfigurationWorks () {
148+ void eurekaDnsConfigurationWorks (CapturedOutput output ) {
153149 new ApplicationContextRunner ()
154150 .withConfiguration (AutoConfigurations .of (EurekaConfigServerBootstrapConfiguration .class ))
155151 .withPropertyValues ("spring.cloud.config.discovery.enabled=true" , "eureka.client.enabled=true" ,
@@ -161,7 +157,7 @@ public void eurekaDnsConfigurationWorks() {
161157 }
162158
163159 @ Test
164- public void eurekaConfigServerInstanceProviderCalled () {
160+ void eurekaConfigServerInstanceProviderCalled (CapturedOutput output ) {
165161 // FIXME: why do I need to do this? (fails in maven build without it.
166162 TomcatURLStreamHandlerFactory .disable ();
167163 new SpringApplicationBuilder (TestConfigDiscoveryConfiguration .class )
@@ -176,7 +172,7 @@ public void eurekaConfigServerInstanceProviderCalled() {
176172 }
177173
178174 @ Test
179- public void eurekaConfigServerInstanceProviderCalledWithRemoteRegions () {
175+ void eurekaConfigServerInstanceProviderCalledWithRemoteRegions (CapturedOutput output ) {
180176 TomcatURLStreamHandlerFactory .disable ();
181177 new SpringApplicationBuilder (TestConfigDiscoveryConfiguration .class )
182178 .properties ("spring.config.use-legacy-processing=true" , "spring.cloud.config.discovery.enabled=true" ,
@@ -190,7 +186,7 @@ public void eurekaConfigServerInstanceProviderCalledWithRemoteRegions() {
190186 }
191187
192188 @ Test
193- public void eurekaConfigServerInstanceProviderCalledWithVipAddress () {
189+ void eurekaConfigServerInstanceProviderCalledWithVipAddress (CapturedOutput output ) {
194190 TomcatURLStreamHandlerFactory .disable ();
195191 new SpringApplicationBuilder (TestConfigDiscoveryConfiguration .class )
196192 .properties ("spring.config.use-legacy-processing=true" , "spring.cloud.config.discovery.enabled=true" ,
0 commit comments