File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
spring-context/src/test/java/org/springframework/jmx Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1616
1717package org .springframework .jmx ;
1818
19+ import java .net .BindException ;
20+
1921import javax .management .MBeanServer ;
2022import javax .management .MBeanServerFactory ;
2123import javax .management .ObjectName ;
2224
2325import org .junit .jupiter .api .AfterEach ;
2426import org .junit .jupiter .api .BeforeEach ;
27+ import org .junit .jupiter .api .extension .RegisterExtension ;
28+ import org .junit .jupiter .api .extension .TestExecutionExceptionHandler ;
29+ import org .opentest4j .TestAbortedException ;
2530
2631import org .springframework .beans .factory .xml .XmlBeanDefinitionReader ;
2732import org .springframework .context .ConfigurableApplicationContext ;
5257 */
5358public abstract class AbstractMBeanServerTests {
5459
60+ @ RegisterExtension
61+ TestExecutionExceptionHandler bindExceptionHandler = (context , throwable ) -> {
62+ // Abort test?
63+ if (throwable instanceof BindException ) {
64+ throw new TestAbortedException ("Failed to bind to MBeanServer" , throwable );
65+ }
66+ // Else rethrow to conform to the contract of TestExecutionExceptionHandler
67+ throw throwable ;
68+ };
69+
5570 protected MBeanServer server ;
5671
5772
You can’t perform that action at this time.
0 commit comments