Could not initialize plugin: interface org.mockito.plugins.MockMaker

后端 未结 25 2267
走了就别回头了
走了就别回头了 2020-12-29 01:01

I\'m getting following exception once tests is started:

    Testcase: treeCtorArgumentTest(com.xythos.client.drive.cachedtree.CachedTreeTest):  Caused an ERR         


        
25条回答
  •  抹茶落季
    2020-12-29 01:20

    This problem with Mockito2 occurs if you enable the option to mock final classes.

    This means when in your test/resources/mockito-extensions directory you have the file called org.mockito.plugins.MockMaker with the following content mock-maker-inline.

    In that case byte-buddy, which is a transitive dependency for mockito-core, has the problem to attach own agent to the java process. But the problem occurs only when you use JRE.

    The solution would be either:

    • Use JDK instead of JRE

    or

    • add -javaagent:byte-buddy-agent-*.jar as a VM option

提交回复
热议问题