在 NetBeans 中运行 JUnit 测试会在返回类型已更改的方法上出现 NoSuchMethodError 错误

发布于 2024-08-11 18:03:10 字数 131 浏览 4 评论 0原文

我在 NetBeans 中有一个带有 JUnit 测试的项目。我对依赖项目中的方法返回类型进行了更改,并且应用程序运行良好。但是,当我从 NetBeans 内部运行 JUnit 测试时,我收到 NoSuchMethodError。我确保清洁和建造。

I have a project in NetBeans with JUnit tests. I made a change to a method return type in a dependent project, and the app runs fine. But when I run the JUnit test from inside NetBeans I get a NoSuchMethodError. I made sure to clean and build.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溇涏 2024-08-18 18:03:10

解决方案是对调用已更改方法的类进行更改(任何更改)。然后我保存了该类,然后撤消了更改并保存了该类。然后在 NetBeans 中运行 JUnit 测试就可以了。这似乎是 NetBeans 缓存的一个错误。我以前遇到过类似的奇怪问题,我不得不关闭 NetBeans,删除 NetBeans 缓存文件夹,然后重新启动 NetBeans。但似乎对该类进行更改(然后撤消它)足以修复 NetBeans 缓存。

The solution was to make a change (any change) to the class which was making the call to the changed method. I then saved the class, then undid the change and saved the class. Then running the JUnit test inside NetBeans worked. It seems like a bug with NetBeans caching. I've had strange issues like this before and I've had to close NetBeans, delete the NetBeans cache folder, and restart NetBeans. But it seems like making a change to that class (and then undoing it) was enough to fix the NetBeans cache.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文