There is a possiblity that this may be a dupicate question. I initialize a String variable to null.I may or may not update it with a value.Now I want to check whether this v
String is immutable
@Test(expected = NullPointerException.class) public void testStringEqualsNull() { String s = null; s.equals(null); } @Test public void testStringEqualsNull2() { String s = null; TestCase.assertTrue(s == null); }