junit.framework.TestCase类型无法解析。它是从所需的.class文件间接引用的

时间:2012-04-18 19:03:47

标签: java jmock junit3

我在这里关注这个例子:jMock - getting started

我收到此错误:无法解析junit.framework.TestCase类型。它是从所需的.class文件间接引用的

我已经导入了这4个罐子:

  • jmock-2.5.1.jar
  • hamcrest-core-1.1.jar
  • hamcrest库-1.1.jar
  • JMock的-junit3-2.5.1.jar

Ant错误意味着什么?

package com.test;

import org.jmock.integration.junit3.MockObjectTestCase;
import org.jmock.Expectations;

class PublisherTest extends MockObjectTestCase {
public void testOneSubscriberReceivesAMessage() {
    // set up
    final Subscriber subscriber = mock(Subscriber.class);

    Publisher publisher = new Publisher();
    publisher.add(subscriber);

    final String message = "message";

    // expectations
    checking(new Expectations() {
        {
            oneOf(subscriber).receive(message);
        }
    });

    // execute
    publisher.publish(message);
    }
}

1 个答案:

答案 0 :(得分:6)

将JUnit 3添加到类路径中。