Skip to content

Commit e4d1dad

Browse files
authored
Merge pull request eugenp#8461 from kwoyke/BAEL-3700
BAEL-3700: Add example of uninitialized Mockito annotations
2 parents 9154e9f + 5768813 commit e4d1dad

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.baeldung.mockito;
2+
3+
import org.junit.Test;
4+
import org.mockito.Mock;
5+
import org.mockito.Mockito;
6+
7+
import java.util.List;
8+
9+
public class MockitoAnnotationsUninitializedUnitTest {
10+
11+
@Mock
12+
List<String> mockedList;
13+
14+
@Test(expected = NullPointerException.class)
15+
public void whenMockitoAnnotationsUninitialized_thenNPEThrown() {
16+
Mockito.when(mockedList.size()).thenReturn(1);
17+
}
18+
}

0 commit comments

Comments
 (0)