美文网首页
spring整合junit时遇到的小问题

spring整合junit时遇到的小问题

作者: 楠瓜团子 | 来源:发表于2018-06-26 16:04 被阅读0次

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 org.junit.internal.requests.ClassRequest@3eb07fd3

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

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

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

4)附上测试类:

5)仓库图:

相关文章

网友评论

      本文标题:spring整合junit时遇到的小问题

      本文链接:https://www.haomeiwen.com/subject/dhdmyftx.html