开发者

Trying to write junit test, missing some basics

When I try to use assertNotLesser or assertNotGreater I get compile error .. and eclipse suggest me to create a new method called like this .. http://junit-addons.sourceforge.net/junitx/framework/ComparableAssert.html I found it here I never used these options before but I need to write this test, I can do it jmock as well but I don't know how .. I need to compare my expected results let say 0, if the rea开发者_运维技巧l result is greater that the test should fail.


Don't forget to add the JUnit-addons JAR to your classpath (download the archive here: http://sourceforge.net/projects/junit-addons/files/).

Alternatively, use assertTrue():

asserTrue ("value1="+value1+" value2="+value2, value1.compareTo(value2) >= 0);


Try this:

assertNotLesser(new Integer(first), new Integer(second));

where first and second are the two integers you want to compare.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜