Used by junit, junit

Source: Internet
Author: User

Used by junit, junit

Today, jsoup is used as'Network crawling instance', However, when the author imports the junit-4.11.jar into the project, add @ Test to the method in the class, but the runtime reports an error, the error code is as follows:

java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing    at java.lang.ClassLoader.defineClass1(Native Method)    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)    at java.security.AccessController.doPrivileged(Native Method)    ...    ... 25 more

After searching on the Internet, it is known that after junit is upgraded to junit4, You need to import the hamcrest jar package to use normally, the author then import the hamcrest-core-1.3.jar in the project, run the project successfully.

NOTE: If junit 3 is used, you only need to import the junit package. For junit 4, you need to import the junit and hamcrest packages.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.