Mockito mocked object suddenly throws NPE

前端 未结 1 1383
庸人自扰
庸人自扰 2021-01-28 02:13

I have a mock:

 static MyGroovyBasedHttpClient createClient(){
    MyGroovyBasedHttpClient client = mock(MyGroovyBasedHttpClient.class);
    Answer

        
1条回答
  •  清歌不尽
    2021-01-28 03:05

    There is a problem with mockito and groovy, you need additional dependency or you can mock only interfaces.

    For more info visit : https://github.com/cyrusinnovation/mockito-groovy-support

    Issue 303 about mockito problem with groovy classes : https://code.google.com/p/mockito/issues/detail?id=303

    0 讨论(0)
提交回复
热议问题