Java

Java

Made by DeepSource

Use assertNull/NotNull instead of assertEquals/notEquals to assert nullity JAVA-W1091

Anti-pattern
Major
Autofix

Use the assertNull and assertNotNull methods instead of using assertEquals or assertNotEquals with an expected null argument.

This issue is raised when the Java analyzer detects a usage of assertEquals or assertNotEquals where one of the arguments is a null value.

Bad Practice

Assertions.assertEquals(null, result);

Recommended

Use the assertNull and assertNotNull methods instead:

Assertions.assertNull(result);