mock nested method calls using mockito

前端 未结 3 1463
深忆病人
深忆病人 2021-02-02 06:05

I have got 4 classes lets says A, B, C, D each calling on methods from another one.

now I have mocked class A, and want to mock a method using mockito

A          


        
3条回答
  •  借酒劲吻你
    2021-02-02 06:48

    Adding RETURNS_DEEP_STUBS did the trick:

    A a = Mockito.mock(A.class, Mockito.RETURNS_DEEP_STUBS);
    

提交回复
热议问题