A JUnit 5 test uses the assertions of JUnit 4, whose argument order and messages differ
What it finds
JUnit 4's Assert takes the message first, JUnit 5's Assertions last. Mixing them in JUnit 5 tests keeps a dependency on JUnit 4 and invites messages passed as values.
Reported is an import of org.junit.Assert in a file that imports org.junit.jupiter.api.Test.
From the rule's source, legacy_assertions_in_jupiter.rs.
import org.junit.jupiter.api.Test;import static org.junit.Assert.assertEquals;tx0 reports: assertions of JUnit 4 class MixedTest { @Test void run() { assertEquals(1, 1); }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:legacy-assertions-in-jupiter" = "warning"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:legacy-assertions-in-jupiter] reason="..."tx0 explain tx0/java:legacy-assertions-in-jupiter shows the same in the terminal. Found a false positive? Report it.