Inspectopedia Help

'assertEquals()' between objects of inconvertible types

Reports calls to assertion methods where the "expected" and "actual" arguments are of incompatible types.

Such calls often indicate that there is a bug in the test. This inspection checks the relevant JUnit, TestNG, and AssertJ methods.

Examples:

assertEquals("1", 1); assertNotSame(new int[0], 0); // weak warning, may just test the equals() contract assertThat(foo).as("user type").isNotEqualTo(bar);

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023