Java Mule FunctionalTestCase是否需要org.junit.rules.TestRule类来运行

Java Mule FunctionalTestCase是否需要org.junit.rules.TestRule类来运行,java,junit,junit4,mule,junit-rule,Java,Junit,Junit4,Mule,Junit Rule,我正在尝试在Mule 3.3中运行一个简单的功能测试。下面是我的示例代码: import java.util.Map; import org.junit.Test; import org.mule.api.MuleMessage; import org.mule.api.client.MuleClient; import org.mule.tck.junit4.FunctionalTestCase; import static org.junit.Assert.*; public cl

我正在尝试在Mule 3.3中运行一个简单的功能测试。下面是我的示例代码:

import java.util.Map;    
import org.junit.Test;
import org.mule.api.MuleMessage;
import org.mule.api.client.MuleClient;
import org.mule.tck.junit4.FunctionalTestCase;
import static org.junit.Assert.*;

public class SoapServiceTest extends FunctionalTestCase {

    @Override
    protected String getConfigResources() {
        return "mule-config.xml,core-config.xml";
    }       

    @Test
    public void testSend() throws Exception
    {
        MuleClient client = muleContext.getClient();
        String payload = "foo";
        Map<String, Object> properties = null;
        MuleMessage result = client.send("http://localhost:61005/service", payload, properties);
        assertNotNull(result.getPayloadAsString());
    }    
}
但它抱怨java.lang.NoClassDefFoundError:org/junit/rules/TestRule。在我的类路径中有junit4.8.1.jar,但没有TestRule类,猜测是junit4.9以后的类

骡子需要这门课吗?我没有使用TestRule的任何注释,这些注释来自:

所以,是的,Mule依赖JUnit4.9,不管您是否直接依赖它

添加时:

<dependency>
    <groupId>org.mule.tests</groupId>
    <artifactId>mule-tests-functional</artifactId>
    <version>3.3.1</version>
    <scope>test</scope>
</dependency>
对于项目的POM,JUnit 4.9应该为您提供。

来源:

所以,是的,Mule依赖JUnit4.9,不管您是否直接依赖它

添加时:

<dependency>
    <groupId>org.mule.tests</groupId>
    <artifactId>mule-tests-functional</artifactId>
    <version>3.3.1</version>
    <scope>test</scope>
</dependency>

对于项目的POM,JUnit 4.9应该为您提供支持。

感谢David的回复和POM链接。我的项目使用Mule 3.3.0,我的项目pom中有上述依赖项,但也为junit4.8.1定义了单独的依赖项。当mule可以启动junit时,为什么我们需要为它定义一个单独的依赖项呢。我在这个示例中看到了相同的趋势,尽管这定义了junit4.9,如果添加了mule功能测试,则不需要在POM中添加JUnit。在你所指的第一章的POM中添加它是我们的疏忽。我已经移除了,谢谢你的解释。希望我能对你的回复和pom链接投更多的票。我的项目使用Mule 3.3.0,我的项目pom中有上述依赖项,但也为junit4.8.1定义了单独的依赖项。当mule可以启动junit时,为什么我们需要为它定义一个单独的依赖项呢。我在这个示例中看到了相同的趋势,尽管这定义了junit4.9,如果添加了mule功能测试,则不需要在POM中添加JUnit。在你所指的第一章的POM中添加它是我们的疏忽。我已经移除了,谢谢你的解释。但愿我能不止一次投票