简体   繁体   English

Eclipse,Java,Junit4,我想对 jar 文件进行黑盒测试。 在设置方面需要一点帮助

[英]Eclipse, Java, Junit4, I want to blackbox test a jar file. Need a little help in setting up

We were given a jar file to do blackbox testing on the methods.我们得到了一个 jar 文件来对这些方法进行黑盒测试。 I know one test is supposed to give us a runtime exception but I'm getting a null pointer exception.我知道一个测试应该给我们一个运行时异常,但我得到一个 null 指针异常。 My question is do I have this setup correctly and do you guys know where I'm going wrong?我的问题是我的设置是否正确,你们知道我哪里出错了吗?

Package explorer is like this Package 资源管理器是这样的

Single test case单个测试用例

Imported JAR file into build path correctly?将 JAR 文件正确导入构建路径?

Test case that is giving the wrong error给出错误错误的测试用例

UML Diagram UML 图

I've never used Eclipse, but from your output it looks like everything is setup fine.我从未使用过 Eclipse,但从您的 output 看来,一切都很好。

I'm not surprised by the NullPointerException either; NullPointerException我也不感到惊讶。 you called addCourse() and passed null instead of a Course .您调用addCourse()并通过null而不是Course

This is clearly homework.这显然是功课。 I don't know what your directions are, but if you don't expect that method to throw NPE, you probably shouldn't be putting nulls in there.我不知道你的方向是什么,但如果你不希望该方法抛出 NPE,你可能不应该在那里放置空值。

Since the exception you're looking for is CourseOverlapException , you probably ought to try adding two SingleLectureCourse s that have overlapping time ranges.由于您要查找的异常是CourseOverlapException ,您可能应该尝试添加两个具有重叠时间范围的SingleLectureCourse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM