BAEL-3700: Add example of uninitialized Mockito annotations

This commit is contained in:
Krzysiek 2020-01-01 21:42:43 +01:00
parent 0846a55404
commit 163a80fd0a
1 changed files with 18 additions and 0 deletions

View File

@ -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);
}
}