Skip to content

Commit 40ec2a0

Browse files
committed
creating mockito mocks with annotations
1 parent f167a87 commit 40ec2a0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package guru.springframework;
2+
3+
import org.junit.jupiter.api.BeforeEach;
4+
import org.junit.jupiter.api.Test;
5+
import org.mockito.Mock;
6+
import org.mockito.MockitoAnnotations;
7+
8+
import java.util.Map;
9+
10+
public class AnnotationMocksTest {
11+
12+
@Mock
13+
Map<String, Object> mapMock;
14+
15+
@BeforeEach
16+
void setUp(){
17+
// MockitoAnnotations.initMocks(this);
18+
MockitoAnnotations.openMocks(this);
19+
}
20+
21+
@Test
22+
void testMock(){
23+
mapMock.put("keyvalue", "foo");
24+
}
25+
}

0 commit comments

Comments
 (0)