The problem comes from Intelij. In cmd the test is working fine. In order to overcome this issue, do the followings steps:
In test resources create the directory mockito-extensions and in that directory the file org.mockito.plugins.MockMaker. The complete path should look like this: src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker.
In the file, add the following line mock-maker-inline