BAEL-3700: Add example of uninitialized Mockito annotations
This commit is contained in:
parent
0846a55404
commit
163a80fd0a
|
@ -0,0 +1,18 @@
|
||||||
|
package com.baeldung.mockito;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MockitoAnnotationsUninitializedUnitTest {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
List<String> mockedList;
|
||||||
|
|
||||||
|
@Test(expected = NullPointerException.class)
|
||||||
|
public void whenMockitoAnnotationsUninitialized_thenNPEThrown() {
|
||||||
|
Mockito.when(mockedList.size()).thenReturn(1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue