惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
博客园 - 【当耐特】
小众软件
小众软件
A
About on SuperTechFans
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
Vercel News
Vercel News
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threatpost
人人都是产品经理
人人都是产品经理
H
Help Net Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LINUX DO - 热门话题
B
Blog
F
Full Disclosure
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threat Research - Cisco Blogs
L
LangChain Blog
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Project Zero
Project Zero
I
InfoQ
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Cloudflare Blog
V
Vulnerabilities – Threatpost
云风的 BLOG
云风的 BLOG
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Check Point Blog
K
Kaspersky official blog
WordPress大学
WordPress大学
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Securelist
T
Tenable Blog
N
News and Events Feed by Topic
The GitHub Blog
The GitHub Blog
W
WeLiveSecurity
Stack Overflow Blog
Stack Overflow Blog
O
OpenAI News
Blog — PlanetScale
Blog — PlanetScale
量子位
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
P
Proofpoint News Feed

博客园 - foward.molly.宝儿

POI 生成excel(大数据量) SXSSF jenkins和sonar的几个问题 ubuntu安装和查看已安装 rails mysql2问题 axis2依赖的其他jar, 版本不是最新的 mysql: 启动和停止服务 mysql: 安装后的目录结构 msyql: mysql rpm安装手记 - foward.molly.宝儿 velocity: velocty转义html xml等 testng: testng使用小结 IE, firefox竖向 横向滚动条处理 ruby: rdoc生成文档的好工具 spring: 一些基本配置--也许只有自己能够读懂 - foward.molly.宝儿 - 博客园 spring: web学习笔记1--异常处理:No adapter for handler - foward.molly.宝儿 maven: maven创建工程,web工程等-普通java app, web app maven: maven编译时指定maven库,即指定profile ssh免密码登录, 发送命令到多个Linux php: eclipse 编辑 php ruby: 使用netbeans debug ruby
Test class should have exactly one public constructor解决办法
foward.molly.宝儿 · 2012-09-21 · via 博客园 - foward.molly.宝儿

测试类用的junit,在eclipse中执行ok,在maven编译就挂

Error Message

Test class should have exactly one public constructor
Stacktrace

java.lang.Exception: Test class should have exactly one public constructor
    at org.junit.runners.BlockJUnit4ClassRunner.validateOnlyOneConstructor(BlockJUnit4ClassRunner.java:136)
    at org.junit.runners.BlockJUnit4ClassRunner.validateConstructor(BlockJUnit4ClassRunner.java:125)
    at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:114)

解决办法,在pom.xml中的maven-surefire-plugin配置中增加以下内容

<include>**/*$*.java</include>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*Test*.java</include>
                    </includes>

                    <excludes>
                        <include>**/test/**/*Test*.java</include>
                        <include>**/servicetest/**/*.java</include>
                        <include>**/*$*.java</include>
                    </excludes>
                    <testFailureIgnore>true</testFailureIgnore>
                    <argLine>-Xmx1024m</argLine>
                </configuration>

应该是junit和maven的surefire plugin不兼容导致的