|
37 | 37 | import org.junit.jupiter.api.AfterEach; |
38 | 38 | import org.junit.jupiter.api.BeforeEach; |
39 | 39 | import org.junit.jupiter.api.Test; |
| 40 | +import org.junit.jupiter.api.condition.EnabledForJreRange; |
| 41 | +import org.junit.jupiter.api.condition.JRE; |
40 | 42 | import org.junit.jupiter.api.extension.ExtendWith; |
41 | 43 | import org.mockito.ArgumentMatcher; |
42 | 44 | import org.mockito.ArgumentMatchers; |
|
57 | 59 | import org.springframework.beans.factory.support.BeanNameGenerator; |
58 | 60 | import org.springframework.beans.factory.support.DefaultBeanNameGenerator; |
59 | 61 | import org.springframework.boot.Banner.Mode; |
| 62 | +import org.springframework.boot.SpringApplication.NativeImageRequirementsNotMetException; |
60 | 63 | import org.springframework.boot.availability.AvailabilityChangeEvent; |
61 | 64 | import org.springframework.boot.availability.AvailabilityState; |
62 | 65 | import org.springframework.boot.availability.LivenessState; |
@@ -744,6 +747,24 @@ void failureOnTheJvmLogsApplicationRunFailed(CapturedOutput output) { |
744 | 747 |
|
745 | 748 | @Test |
746 | 749 | @ForkedClassPath |
| 750 | + @EnabledForJreRange(max = JRE.JAVA_24) |
| 751 | + void nativeImageShouldCheckForJava25() { |
| 752 | + System.setProperty("org.graalvm.nativeimage.imagecode", "true"); |
| 753 | + try { |
| 754 | + SpringApplication application = new SpringApplication(); |
| 755 | + application.setWebApplicationType(WebApplicationType.NONE); |
| 756 | + assertThatExceptionOfType(NativeImageRequirementsNotMetException.class).isThrownBy(application::run) |
| 757 | + .withMessage( |
| 758 | + "Native Image requirements not met, please upgrade it. Native Image must support at least Java 25"); |
| 759 | + } |
| 760 | + finally { |
| 761 | + System.clearProperty("org.graalvm.nativeimage.imagecode"); |
| 762 | + } |
| 763 | + } |
| 764 | + |
| 765 | + @Test |
| 766 | + @ForkedClassPath |
| 767 | + @EnabledForJreRange(min = JRE.JAVA_25) |
747 | 768 | void failureInANativeImageWritesFailureToSystemOut(CapturedOutput output) { |
748 | 769 | System.setProperty("org.graalvm.nativeimage.imagecode", "true"); |
749 | 770 | try { |
|
0 commit comments