Steps:
Add dependency to Mockito version 2.x in your gradle
(at the time of writing this text the latest version is 2.7.22):
testCompile "org.mockito:mockito-core:$versions.mockito"
Create a file in test resources with name org.mockito.plugins.MockMaker
:
Add next line in this file:
mock-maker-inline