How to mock a final class with mockito

后端 未结 25 1400
日久生厌
日久生厌 2020-11-22 16:35

I have a final class, something like this:

public final class RainOnTrees{

   public void startRain(){

        // some code here
   }
}

I

25条回答
  •  难免孤独
    2020-11-22 16:40

    If you trying to run unit-test under the test folder, the top solution is fine. Just follow it adding an extension.

    But if you want to run it with android related class like context or activity which is under androidtest folder, the answer is for you.

提交回复
热议问题