我有這樣的代碼結構。方法methodToTest在ClassA呼籲在ClassA的方法以及以及在ClassB public class ClassA {
@Autowired
ClassB classB;
public void methodToTest() {
Object c = methodInA();
Object d = class
註釋的Mockito或@Spy將@InjectMocks不能在接口工作: public interface MyService() {}
public class MyServiceImpl implements MyService {}
@RunWith(MockitoJUnitRunner.class)
public class MyServiceTest {
@Spy
根據sinon.js的文檔,我可以這樣做:var spy = sinon.spy(myFunc);,但它不起作用。這是我的努力: var sinon = require("sinon");
describe('check bar calling', function(){
it('should call bar once', function() {
var barSpy