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.
A:
Try this:
assertNotLesser(new Integer(first), new Integer(second));
where first and second are the two integers you want to compare.
klez
2010-03-12 12:41:05
method does not exist with that or any other signature..
Gandalf StormCrow
2010-03-12 12:56:11
+1
A:
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);
Aaron Digulla
2010-03-12 12:50:17