Junit单元测试报错:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing at java.lang.ClassLoader.de

导入的是junit_V4.8.2

查了半天如下发现:

  • junit.jar: Includes the Hamcrest classes. The simple all-in-one solution to get started quickly.Starting with version 4.11, Hamcrest is no longer included in this jar.

注意黑色加下划线的部分意思是4.11以上版本不在包含hamcrest

解决办法:

   1.junit版本降到4.10

   2.导入hamcrest-core-1.3.jar

你可能感兴趣的:(J2EE框架学习)