String str = "Hello World!"; AssertJUnit.assertNotNull(str);
Listlist = new ArrayList<>(); AssertJUnit.assertNotNull(list);
Person person = null; AssertJUnit.assertNotNull(person);In this example, we set the person object to null and we use the assertNotNull method to verify that it is indeed null, which will result in a failed test case. The TestNG library is a testing framework for Java.