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 ...
随机推荐
- 配置iis支持.json格式的文件
配置iis支持.json格式的文件发现要让IIS支持json文件并不是单纯的添加mime这么简单啊,以下是设置方法:一.IIS 6 1. MIME设置:在IIS的站点属性的HTTP头设置里,选MIME ...
- JavaScript数组(三)数组对象使用整理
一.数组声明方法1. var a=new Array();2. var a=new Array([size]);3.var a=new Array(['a'],[1],['b'],[123]);4. ...
- 为什么样本方差分母是n-1
https://blog.csdn.net/qq_39521554/article/details/79633207 为什么样本方差的分母是n-1?为什么它又叫做无偏估计? 至于为什么是n-1,可以看 ...
- [Ramda] Lens in Depth
In this post, we are going to see how to use Ramda Lens. For example, we have data: const {log} = re ...
- cookie 跨域解决方法
1.Nginx 正向和反向代理的区别 正向代理和反向代理的区别:正向代理隐藏真实客户端,反向代理隐藏真实服务端,图示: 2.cookie跨域问题 因为cookie存在跨域问题,其中一个解决方法是,设置 ...
- go微服务框架go-micro深度学习-目录
go微服务框架go-micro深度学习(一) 整体架构介绍 go微服务框架go-micro深度学习(二) 入门例子 go微服务框架go-micro深度学习(三) Registry服务的注册和发现 go ...
- fiddle扩展
扩展地址:http://www.telerik.com/fiddler/add-ons 证书选择 ios设置证书生成 (CertMaker for iOS and Android) 证书查看 (Fid ...
- SpUtil多样加密存储,兼容android9.0
代码地址如下:http://www.demodashi.com/demo/15058.html 前言 在android系统不断升级的过程中,Sharepreferences存储出现多中问题,其中有些是 ...
- myBase7 激活方法
一.引言: 之前使用过一段时间的myBase,那时候发现还不太美观,所以弃用了一段时间,最近看到有myBase7出来,使用了一下感觉还可以,但是只能试用一个月,不过还好找到了破解的方法. 二.破解步骤 ...
- AYUI7 WPF MVC插件欣赏
AYUI7 MVC 提前预览 一个插件安装,享受所有快捷操作 静态图: 支持xaml中aymvc快速绑定多个操作 支持controller中 ayaction快速创建action代码块, 在AYU ...