How to verify if method was called from other with same class by mockito

前端 未结 1 1119
时光说笑
时光说笑 2020-12-24 10:45

I want to test some methods that call others in the same class. They are basically the same methods, but with different numbers of arguments because there are some default v

相关标签:
1条回答
  • 2020-12-24 11:42

    You would need a spy, not a mock A:

        A a = Mockito.spy(new A(1,1));
        a.getPrice(2);
        verify(a, times(1)).getPriceForOne();
    
    0 讨论(0)
提交回复
热议问题