Gandalf StormCrow
Gandalf StormCrow

Reputation: 26212

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 real result is greater that the test should fail.

Upvotes: 2

Views: 363

Answers (2)

Aaron Digulla
Aaron Digulla

Reputation: 328800

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);

Upvotes: 1

Federico klez Culloca
Federico klez Culloca

Reputation: 27149

Try this:

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

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

Upvotes: 0

Related Questions