A test method carries @Test together with another annotation that makes it a test
What it finds
In JUnit 5, @ParameterizedTest, @RepeatedTest, @TestFactory and @TestTemplate each make a method a test of their own kind. Adding @Test as well registers the method twice, and the plain run without arguments fails, as the JUnit user guide explains.
Reported is a method annotated with @Test and one of these.
From the rule's source, competing_test_annotations.rs.
import org.junit.jupiter.api.Test;import org.junit.jupiter.params.ParameterizedTest;import org.junit.jupiter.params.provider.ValueSource; class MathTest { @Testtx0 reports: make this method run twice @ParameterizedTest @ValueSource(ints = {1, 2}) void check(int value) {} @Test void plain() {}} 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:competing-test-annotations" = "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:competing-test-annotations] reason="..."tx0 explain tx0/java:competing-test-annotations shows the same in the terminal. Found a false positive? Report it.