简单的 Junit 配置不起作用
我有一些旧代码想使用 Junit 进行测试。导入到Eclipse后,如下所示:
之后,我尝试测试类 ACos
。我输入了一些值,但不起作用。我明白了:
我做错了什么?
I have some old code that I would like to test using Junit. After importing it into Eclipse it looks like this:
After this, I try to test the class ACos
. I've entered some values, but it doesn't work. I get this:
What have I done wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您的测试类位于主包中(=“”)。尝试不使用 jscicalc.pobject。
更正:如果 pobject 应该是包,则应将其设置为源文件夹。 (右键单击 -> 在其上构建路径)。
Looks like your class under test is in the main package (= ""). Try without jscicalc.pobject.
Correction: If pobject is supposed to be the package, you should set it as source folder. (Right-click -> Build path on it).
您的 Java 代码应位于
src
文件夹下,而不是 pobject 文件夹下。它可能也需要位于一个包中,但是如果不看到其中的代码,就不容易判断。移动它时发生的错误也应该很明显。
Your Java code should be under the
src
folder and not the pobject folder.It probably needs to be in a package as well, but that's not as easy to tell without seeing the code within it. It should also be obvious with the errors that occur when moving it.