我尝试在STS (Spring工具套件)中调试一个junit测试。
当我尝试在测试对象下的类的任何方法中执行“step-into”时,我得到
com.sun.jdi.InternalException: Got error code in reply:35 occurred retrieving 'this' from stack frame。
当我在IntelliJ IDEA中做同样的事情时,我会得到
'this' is not available。
我尝试了Using the Eclipse remote debugger throws com.sun.jdi.InternalException上的所有东西,但都没有用。
我使用以下命令安装了java:
brew cask install adoptopenjdk8。
STS版本为4.7.0.RELEASE
IntelliJ IDEA版本为2020.1.2
JUnit版本为4.13
发布于 2020-07-02 00:50:58
最后,在对所有工具进行大量调试和隔离之后,我发现罪魁祸首是
mock-maker-inline
我将其添加到项目的src/test/resources/mockito-extensions目录中以模拟最终类(参考:https://www.baeldung.com/mockito-final)。
请随时评论任何更好的方式,我不需要添加这一行,并且仍然可以模拟最终类+不会得到那个异常。
https://stackoverflow.com/questions/62661996
复制相似问题