Skip to content

Commit 8da7ca6

Browse files
committed
Add workaround for IDEA-317391 failing junit tests
Create a workaround to avoid failing tests when running multiple Maven modules at once. This can be removed once https://youtrack.jetbrains.com/issue/IDEA-317391 is fixed.
1 parent 336b055 commit 8da7ca6

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

acceptance-tests/acceptance-tests-checkerframework/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
4343
--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
4444
--add-opens=jdk.compiler/com.sun.source.util=ALL-UNNAMED
45+
46+
<!-- Workaround for https://youtrack.jetbrains.com/issue/IDEA-317391 -->
47+
-DmvnArgLinePropagated=true
4548
</argLine>
4649
<checkerframework.version>3.32.0</checkerframework.version>
4750
</properties>

acceptance-tests/acceptance-tests-checkerframework/src/test/groovy/io/github/ascopes/jct/acceptancetests/checkerframework/CheckerNullTest.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ class CheckerNullTest {
3131

3232
@BeforeEach
3333
void setUp() {
34+
// Workaround for https://youtrack.jetbrains.com/issue/IDEA-317391
35+
assumeThat(System.getProperty("mvnArgLinePropagated", "false"))
36+
.withFailMessage("Your IDE has not propagated the <argLine/> in the pom.xml")
37+
.isEqualTo("true");
38+
3439
assumeThat(JRE.currentVersion())
35-
.as("Checkerframework may misbehave on this JVM, so has been disabled")
40+
.withFailMessage("Checkerframework may misbehave on this JVM, so has been disabled")
3641
.isIn(JRE.JAVA_16, JRE.JAVA_17, JRE.JAVA_18, JRE.JAVA_19, JRE.JAVA_20)
3742
}
3843

acceptance-tests/acceptance-tests-error-prone/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
4646
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
4747
--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
48+
49+
<!-- Workaround for https://youtrack.jetbrains.com/issue/IDEA-317391 -->
50+
-DmvnArgLinePropagated=true
4851
</argLine>
4952

5053
<error-prone.version>2.18.0</error-prone.version>

acceptance-tests/acceptance-tests-error-prone/src/test/groovy/io/github/ascopes/jct/acceptancetests/errorprone/ErrorProneTest.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,23 @@ package io.github.ascopes.jct.acceptancetests.errorprone
1818
import io.github.ascopes.jct.compilers.JctCompiler
1919
import io.github.ascopes.jct.junit.JavacCompilerTest
2020
import io.github.ascopes.jct.workspaces.Workspaces
21+
import org.junit.jupiter.api.BeforeAll
2122
import org.junit.jupiter.api.DisplayName
2223

2324
import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
25+
import static org.assertj.core.api.Assumptions.assumeThat
2426

2527
@DisplayName("Error-prone acceptance tests")
2628
class ErrorProneTest {
2729

30+
@BeforeAll
31+
static void workAroundIdea317391() {
32+
// Workaround for https://youtrack.jetbrains.com/issue/IDEA-317391
33+
assumeThat(System.getProperty("mvnArgLinePropagated", "false"))
34+
.withFailMessage("Your IDE has not propagated the <argLine/> in the pom.xml")
35+
.isEqualTo("true");
36+
}
37+
2838
@DisplayName("Happy paths work as expected")
2939
@JavacCompilerTest
3040
void happyPathsWorkAsExpected(JctCompiler compiler) {

0 commit comments

Comments
 (0)