GH-77 - Upgrade to Spring Boot 3.0.
Adapt to API changes in Micrometer and Spring Boot's test context loader API now exposing a checked ContextLoadException to signal failures during ApplicationContext bootstraps.
This commit is contained in:
@@ -25,6 +25,7 @@ import org.springframework.boot.test.context.assertj.AssertableApplicationContex
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.test.context.BootstrapContext;
|
||||
import org.springframework.test.context.CacheAwareContextLoaderDelegate;
|
||||
import org.springframework.test.context.ContextLoadException;
|
||||
import org.springframework.test.context.MergedContextConfiguration;
|
||||
import org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate;
|
||||
import org.springframework.test.context.support.DefaultBootstrapContext;
|
||||
@@ -52,13 +53,10 @@ public class TestUtils {
|
||||
|
||||
return (ConfigurableApplicationContext) loader.loadContext(configuration);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
if (e instanceof RuntimeException) {
|
||||
throw (RuntimeException) e;
|
||||
}
|
||||
|
||||
throw new RuntimeException(e);
|
||||
} catch (ContextLoadException o_O) {
|
||||
throw asRuntimeException(o_O.getCause());
|
||||
} catch (Exception o_O) {
|
||||
throw asRuntimeException(o_O);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,4 +68,8 @@ public class TestUtils {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static RuntimeException asRuntimeException(Throwable o_O) {
|
||||
return o_O instanceof RuntimeException ? (RuntimeException) o_O : new RuntimeException(o_O);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user