首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JUnit NoClassDefFoundError

JUnit NoClassDefFoundError
EN

Stack Overflow用户
提问于 2013-05-18 22:26:51
回答 1查看 1.9K关注 0票数 1

我是JUnit的新手,用的是inteliji idea。

代码语言:javascript
复制
import org.junit.Test;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Date;
import static org.junit.Assert.*;
public class TestQuote {
    @Test
    public void testQuote() {
        Date date = new Date(System.currentTimeMillis());
        Quote quote=new Quote("a",date,200.0,300.0,100.0,107.0,1.0);
        assertNull("Object is null",quote);
        assertEquals("Symbol is ok",quote.getSymbol(),"a");
        assertEquals("Date is ok",quote.getDate(),System.currentTimeMillis());
        assertEquals("Open price is ok",quote.getOpenPrice(),200.0);
        assertEquals("High price is ok",quote.getHighPrice(),300.0);
        assertEquals("Low price is ok",quote.getLowPrice(),100.0);
        assertEquals("Close price is ok",quote.getClosePrice(),107.0);
    }
}

下面是我的测试类的代码。JUnit.jar被添加到类路径中,但当我运行它时,它显示:

代码语言:javascript
复制
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

有什么解决办法吗?顺便说一句,主程序运行正常。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-18 22:41:53

请访问JUnit网站:http://junit.org/

然后点击“下载和安装指南”:https://github.com/junit-team/junit/wiki/Download-and-Install

然后阅读:

下载以下JAR并将它们放到您的测试类路径中:

  • junit.jar
  • hamcrest-core.jar
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16625356

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档