|
19 | 19 | import static io.github.ascopes.jct.tests.helpers.Fixtures.someRelease; |
20 | 20 | import static org.assertj.core.api.Assertions.assertThat; |
21 | 21 | import static org.assertj.core.api.Assertions.assertThatThrownBy; |
| 22 | +import static org.assertj.core.api.Assumptions.assumeThat; |
22 | 23 |
|
23 | 24 | import io.github.ascopes.jct.compilers.CompilationMode; |
24 | 25 | import io.github.ascopes.jct.compilers.DebuggingInfo; |
@@ -211,16 +212,38 @@ void annotationProcessingOnlyAddsProcOnly() { |
211 | 212 | assertThat(flagBuilder.build()).containsExactly("-proc:only"); |
212 | 213 | } |
213 | 214 |
|
214 | | - @DisplayName(".compilationMode(COMPILATION_AND_ANNOTATION_PROCESSING) adds -proc:full") |
| 215 | + @DisplayName(".compilationMode(COMPILATION_AND_ANNOTATION_PROCESSING) adds -proc:full (JDK22)") |
215 | 216 | @Test |
216 | | - void compilationAndAnnotationProcessingAddsProcAll() { |
| 217 | + void compilationAndAnnotationProcessingAddsProcFullOnJdk22() { |
| 218 | + // Given |
| 219 | + assumeThat(Runtime.version().feature()) |
| 220 | + .as("JDK version") |
| 221 | + .withFailMessage("this test only works on JDK 22 and newer") |
| 222 | + .isGreaterThanOrEqualTo(22); |
| 223 | + |
217 | 224 | // When |
218 | 225 | flagBuilder.compilationMode(CompilationMode.COMPILATION_AND_ANNOTATION_PROCESSING); |
219 | 226 |
|
220 | 227 | // Then |
221 | 228 | assertThat(flagBuilder.build()).containsExactly("-proc:full"); |
222 | 229 | } |
223 | 230 |
|
| 231 | + @DisplayName(".compilationMode(COMPILATION_AND_ANNOTATION_PROCESSING) adds nothing (<JDK22)") |
| 232 | + @Test |
| 233 | + void compilationAndAnnotationProcessingAddsNothingBeforeJdk22() { |
| 234 | + // Given |
| 235 | + assumeThat(Runtime.version().feature()) |
| 236 | + .as("JDK version") |
| 237 | + .withFailMessage("this test only works on JDK 21 and older") |
| 238 | + .isLessThan(22); |
| 239 | + |
| 240 | + // When |
| 241 | + flagBuilder.compilationMode(CompilationMode.COMPILATION_AND_ANNOTATION_PROCESSING); |
| 242 | + |
| 243 | + // Then |
| 244 | + assertThat(flagBuilder.build()).isEmpty(); |
| 245 | + } |
| 246 | + |
224 | 247 | @DisplayName(".compilationMode(...) returns the flag builder") |
225 | 248 | @EnumSource(CompilationMode.class) |
226 | 249 | @ParameterizedTest(name = "for compilationMode = {0}") |
|
0 commit comments