A JUnit 5 test method is private, static or returns a value, so JUnit silently skips it
What it finds
JUnit Jupiter runs only test methods that are not private, not static and return void, as its user guide says; others are skipped without a word, so the test looks green while it never ran.
Reported, in a file that imports org.junit.jupiter, is a method annotated @Test, @ParameterizedTest or @RepeatedTest that is private or static or does not return void.
From the rule's source, skipped_junit_test.rs.
import org.junit.jupiter.api.Test; class SkippedTest { @Testtx0 reports: since it is private private void hidden() {} @Testtx0 reports: since it is static static void shared() {} @Testtx0 reports: since it is not void int value() { return 1; } @Test void runs() {}} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/java:skipped-junit-test" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:skipped-junit-test] reason="..."tx0 explain tx0/java:skipped-junit-test shows the same in the terminal. Found a false positive? Report it.