Junit4 + Spring 2.5:断言抛出“NoClassDefFoundError” [英] Junit4 + Spring 2.5 : Asserts throw "NoClassDefFoundError"

查看:116
本文介绍了Junit4 + Spring 2.5:断言抛出“NoClassDefFoundError”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Spring在Junit4中编写测试,我得到了这个有趣的行为:

I've been coding tests in Junit4 with Spring, and I got this funny behavior:

如果我的测试像这样传递,一切都很好:

If my tests are passing like this, everything is fine:

@Test
public void truthTest(){

    assertTrue(true); //Ok

}

但是,如果我的测试失败:

But, if my test fails:

@Test
public void truthTest(){

    assertTrue(false); //ERROR

}

然后我收到一个测试失败而不是测试失败丑陋而神秘的堆栈追踪,就是这样:

Then instead of a test failure I receive an ugly and cryptic stack trace, This is it:

http:// pastie.org/429912

对于这个丑陋的转储感到抱歉,但它是我解释问题的唯一数据(我为它贴了可读性)

Sorry for this ugly dump, but its the only data I've got to explain the problem (I "pastied" it for readability)

我真的很困惑,有没有人遇到过这种问题?提前致谢!

I'm really puzzled, has anyone encountered this kind of problem before? Thanks in advance!

推荐答案

http://jira.springframework.org/browse/SPR-5145

这是spring-test 2.5的一个已知问题。X。它与JUnit 4.5不兼容。使用4.0-4.4。

It is an known issue with spring-test 2.5.x. It is incompatible with JUnit 4.5. Use 4.0-4.4.

或者你可以在问题跟踪器中试用补丁。

Or you can try the patch in the issue tracker.

这篇关于Junit4 + Spring 2.5:断言抛出“NoClassDefFoundError”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆