import static org.hamcrest.Matchers.*; public class ExampleTest { @Test public void testNotNull() { Object obj = new Object(); assertThat(obj, notNullValue()); } }
The above code is an example of Hamcrest using the assertNotNull matcher.org.hamcrest hamcrest-all 1.3