String str = null; Assert.assertNull(str); // passes String str2 = "hello"; Assert.assertNull(str2); // fails, throws AssertionError
ListThis method is part of the TestNG testing framework, which is a Java library used for unit testing and functional testing. The package library is `org.testng`.nums = new ArrayList (); Assert.assertNull(nums); // fails, throws AssertionError nums = null; Assert.assertNull(nums); // passes