This error can also happen in case of inheritance. If class A inherits from B and you are using
MockedStatic<A> mockAStatic = Mockito.mockStatic(A.class);
and you try to mock a method which is inherited from B, you'll get the above mentioned error. To fix it use the mock for B.