It is common to make assertions in test cases to check if a particular variable is null or not null.
These checks can be achieved using the existing System.assertEquals(expected, actual, msg) and System.assertNotEquals(expected,actual, msf) methods. However, these can make the intention of the assertion less clear. For example, from a tweet
"System.AssertException: Assertion Failed: Expected: null, Actual: null" - I need a second opinion.
This could be produced by something like this simplified code:
It makes the actual problem with the assertion hard to determine.
Please add addtional System.assertNotNull(variable, msg)
and System.assertNull(variable, msg)
Type checking in assertions is another common scenario. Please add System.assertIsInstanceOfType(variable, type, msg)