Pregunta

I'm trying to run a simple Functional test in Mule 3.3. Below is my sample code:

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());
    }    
}

But it complains java.lang.NoClassDefFoundError: org/junit/rules/TestRule. I've junit4.8.1.jar in my classpath but that doesn't have TestRule class which guess is junit4.9 onwards.

Does Mule needs this class? I'm not using any of the annotations of TestRule

¿Fue útil?

Solución

From Mule's parent POM:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.9</version>
</dependency>

So yes, Mule relies on JUnit 4.9, whether you depend on it directly or not.

When you add:

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

to your project's POM, JUnit 4.9 should be pulled in for you.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top