java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法
在进行简单的Junit单元测试时,测试一直报错:
先来看一下我的单元测试类:
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.cn21.tinyProject.dao.mapper.FlowProductInfoMapper; /**
* <p>
* 流量接口测试类
* <p>
*
* @author <a href="mailto:yangkj@corp.21cn.com">yangkj</a>
* @version
* @since 2017年3月13日
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
public class FlowServiceImplTest { @Autowired
private FlowProductInfoMapper flowProductInfoMapper; @Test
public void run() {
System.out.println("xsxs");
}
}
能看到同时使用了:spring-test(版本:4.2.0.RELEASE)和Junit(版本:4.10)
异常信息如下:
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test], {ExactMatcher:fDisplayName=test(com.cn21.tinyProject.service.FlowServiceImplTest)], {LeadingIdentifierMatcher:fClassName=com.cn21.tinyProject.service.FlowServiceImplTest,fLeadingIdentifier=test]] from org.junit.internal.requests.ClassRequest@787ad957
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
这个异常很奇怪,自信这么简单的代码应该不会有错的,网上找了相同的异常,大家说是spring-test的版本问题。
于是自己将Spring-test的版本修改一下(改为4.1.0.RELEASE),发现运行正常。
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法的更多相关文章
- 测试--错误java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=select], {ExactMatcher:fDisplayName=select(com.rjj.demo.DemoApplicationTests)]...
异常这个错误java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=select], {ExactMatche ...
- junit test 报错,java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=esopCreateTest],
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=esopCreateTest], {ExactMatc ...
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testSelect], {ExactMatcher:fDisplayName=testSelect(cool.zsn.Dao.UserMapperTest)], {LeadingIdentifierMatcher:fClassName=cool.zsn
@Before:每次调用类中的方法,都会先执行@Before下的方法 @Before下的方法应该是 public : @Before public void init() { application ...
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=fun2], {ExactMatcher:fDisplayName=fun2(cn.itcast.demo2.fun1)], {LeadingIdentifierMatcher:fClassName=cn.itcast.demo2.fun1,fLeadi
Junit报的错误, 在测试方法前面没有添加注解@Test
- 谈一谈JUnit神奇的报错 java.lang.Exception:No tests found matching
最近在学习Spring+SpringMVC+MyBatis,一个人的挖掘过程确实有点艰难,尤其是有一些神奇的报错让你会很蛋疼.特别是接触一些框架还是最新版本的时候,会因为版本问题出现很多错误,欢迎大家 ...
- 关于java.lang.Exception:No tests found matching的一系列解决方法
问题描述: java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=yahaa], {ExactMatcher ...
- java.lang.Exception: No tests found matching(Junit测试异常)
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=save], {ExactMatcher:fDispl ...
- java.lang.Exception: No tests found matching Method tes(com.bw.test.Testrefiect) from org.junit.vintage.engine.descriptor.RunnerRequest@3bfdc050 at org.junit.internal.requests.FilterRequest.getRunner
junit 方法 没有加上注解 @Test java.lang.Exception: No tests found matching Method tes(com.bw.test.Testre ...
- 错误:java.lang.Exception: No tests found matching Method testPrePage1(egou_manager_web.TestEBrand) from org.junit.internal.requests.ClassRequest@4f3cc73c
今天测试分页时出现以下错误: java.lang.Exception: No tests found matching Method testPrePage1(egou_manager_web.Tes ...
随机推荐
- sencha touch 学习汇总(转)
1.官方网站:http://www.sencha.com/products/touch/ 2.在线文档:http://docs.sencha.com/touch/2.2.1/ 3.在线翻译文档:htt ...
- 页面嵌套iframe后,点击里面的链接,然后父窗口跳转(子窗口控制父窗口的链接跳转)
做app的时候遇到一个问题,一个页面,然后里面嵌套了一个另一个页面,想实现点击里面的链接,然后外面进行跳转,不然的话,里面的页面永远出不来, 后面想了个办法,app的页面都是打开打开,不关闭的,然后由 ...
- Compile groovy mixed with java in Maven
Assuming that groovy codes are in src/main/groovy and java codes are in src/main/java. We can use 2 ...
- JDBC(14)—对DAO进行改进修改
结构: DAO2_7< T >(接口)->DAOTestImpl< T >(实现类)->CustomerDAO(继承的子类)->CustomerDAOTest ...
- springmvc中select可以绑定enum中所有数据的方法
public enum States { AK("AK"), AL("AL"), AR("AR"), AZ("AZ"), ...
- Nginx的https配置记录以及http强制跳转到https的方法梳理
一.Nginx安装(略)安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块.Nginx安装方法: 1 2 # ./con ...
- 对类的理解(c++)
介绍目录: 1.类成员 1.1 成员函数 1.2 构造函数 1.2.1 对构造函数的理解 1.2.2成员初始化列表 1.2.3必须使用成员初始化列表的几种情况 1.2.4对于拷贝构造函数的参数是一个引 ...
- 解决Linux系统80端口被占用的问题
有Linux在centos下面安装webmail服务遇到80端口被占用的问题,导致无法继续安装,下面详细介绍下Linux如何查看.查找.关闭监听80端口服务以更好的的解决80端口被占用的问题. 一.查 ...
- SSE图像算法优化系列二十九:基础的拉普拉斯金字塔融合用于改善图像增强中易出现的过增强问题(一)
拉普拉斯金字塔融合是多图融合相关算法里最简单和最容易实现的一种,我们在看网络上大部分的文章都是在拿那个苹果和橙子融合在一起,变成一个果橙的效果作为例子说明.在这方面确实融合的比较好.但是本文我们主要讲 ...
- jvm理论-字节码指令案例
案例1 public class Demo { public int calc(){ int a=100; int b=200; int c=300; return(a+b)*c; } public ...