1)今天学习spring框架整合junit时遇到这样一个问题:

java.lang.Exception:No tests found matching [{ExactMatcher:fDisplayName=test], {ExactMatcher:fDisplayName=test(spring.SpringTest2)], {LeadingIdentifierMatcher:fClassName=spring.SpringTest2,fLeadingIdentifier=test]] from [email protected]

spring整合junit时遇到的小问题


2)单独运行测试方法是上面的错误,直接运行测试类,错误变成这样:

spring整合junit时遇到的小问题


3)通过直接运行测试类的错误发现重要的一句话:SpringJUnit4ClassRunner requires JUnit 4.12 or higher.

意思是:SpringJUnit4ClassRunner 要求junit使用4.12版本或者更高,然后去看了pom.xml,果然里面的版本是4.11,改成4.12就可以了;


4)附上测试类:

spring整合junit时遇到的小问题


5)仓库图:

spring整合junit时遇到的小问题

相关文章:

  • 2021-12-31
  • 2021-08-11
  • 2021-12-17
  • 2022-12-23
  • 2021-04-24
  • 2021-11-25
  • 2021-07-08
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2021-04-21
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案