Hi, allSince there is an issue with powermock and jacoco, see
at https://github.com/powermock/powermock/issues/727. so 
if you use powermock with unit test , Sonarcloud will not
get the right coverage. You can read more at PR #1916
<https://github.com/apache/incubator-dolphinscheduler/pull/1916&gt;.


Mockito works well with jacoco, So I suggest use&nbsp;Mockito
use as much as possible.


Further more, there are some discuss about PowerMock VS
Mockito, as:
https://stackoverflow.com/questions/6036450/powermock-mockito-vs-mockito-alone
https://stackoverflow.com/questions/5920153/test-class-with-a-new-call-in-it-with-mockito


And I support this opinion:
&gt; There is nothing preventing me from using&nbsp;final,&nbsp;new, 
or&nbsp;static...&nbsp;
&gt; but it is my&nbsp;Opinion&nbsp;that code in such methods shouldn't require 
mocking&nbsp;
&gt; if I choose to use them. If they are that complex or riddled with side 
effects,
&gt; I probably should think about encapsulating into other objects so I could 
inject&nbsp;
&gt; mocks at test time or when implementations change.&nbsp;

Reply via email to