我怎么能用mockito停止调用方法?

问题描述 投票:-3回答:1

当我从Test类调用函数方法时,我希望executeSol方法不运行,因为它会导致我的错误。

public String funciones(String arguments){
    //Many operations . . . 
    animalInterface.executeSol(integer id, String msg); <-- void 
  return soluciones;
}
java mockito
1个回答
0
投票

看看这个链接,https://gist.github.com/mariuszs/7489190有一个关于如何测试异常的很好的例子。这是之前被问到的。 Mockito How to mock and assert a thrown exception?

© www.soinside.com 2019 - 2024. All rights reserved.