java - Junit method not found -
i'm trying build sample test class using junit framework.
i've downloaded junit4.9b3.
when try complie test class following error:-
javac -cp ".;c:\documents , settings\user\desktop\junit\junit4.9b3\junit-4.9b3.jar" testsubscription.java testsubscription.java:10: cannot find symbol symbol : method asserttrue(boolean) location: class testsubscription asserttrue(s.pricepermonth()==100.0); ^ testsubscription.java:17: cannot find symbol symbol : method asserttrue(boolean) location: class testsubscription asserttrue(s.pricepermonth()==66.67); ^ 2 errors looks asserttrue not available junit javadoc mentions method.
i'm using import follows
import org.junit.*; import org.junit.assert.*; any ideas?
you've imported types, not used static import make members available without qualification. if use:
import static org.junit.assert.*; then should statically import static methods in assert class, can write asserttrue instead of assert.asserttrue.
note presumably assert has nested types, otherwise i'd have expected "normal" import fail.
Comments
Post a Comment