assertEquals gets the literal expected value second, so a failure reports the values the wrong way round

tx0/kotlin:assertion-arguments-swappedrecommendedwarningmaintainability/testsdepth fasttest

What it finds

JUnit and kotlin.test take the expected value first: assertEquals(expected, actual). With a literal second, the message of a failure calls the computed value expected and the literal actual, which misleads the reader.

From the rule's source, assert_arguments_swapped.rs.

Example from the rule's tests
class ParserTest {    @Test    fun parses() {        assertEquals(parse("1"), 1)tx0 reports: the literal expected value is passed as the actual one        assertEquals(1, parse("1"))        assertEquals("the sum", sum(), 3)tx0 reports: the literal expected value is passed        assertEquals(expected = 1, actual = parse("1"))        assertEquals(a, b)    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/kotlin:assertion-arguments-swapped" = "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/kotlin:assertion-arguments-swapped] reason="..."

tx0 explain tx0/kotlin:assertion-arguments-swapped shows the same in the terminal. Found a false positive? Report it.