I started learning junits, and i am trying to mock arraylist class, but it is showing me null pointer exception.
here is my code:
public class MyListTest {
@Mock
ArrayList<String> al;
@Test
public void whenNotUseMockAnnotation_thenCorrect() {
when(al.add("a")).thenReturn(true);
assertTrue(al.add("a"));
}
}