Hi,

I'm using Maven 1, trying to migrate.

We are using Betwixt and some of our unit tests fail when run using
surefire, but run fine in IntelliJ or Maven 1. Betwixt looks for descriptors
with the name of the class + .betwixt to control how something is written
out in XML. It uses the construct: myClass.getResource() to find the
.betwixt file.

E.g. com.mycomp.MyClass -> com/mycomp/MyClass.betwixt

We have a betwixt file for the java.util.Date class. However, betwixt seems
to be unable to pick it up when using surefire. I have created a small test
that shows the problem.

import junit.framework.TestCase;
import java.util.Date;
import java.net.URL;

public class CLTest extends TestCase
{
   public void testClassloading()
   {
       ClassLoader classLoader = getClass().getClassLoader();
       System.out.println( "classLoader: " + classLoader );
       URL resource = getClass().getResource( "/java/util/Date.betwixt" );
       System.out.println( "resource: " + resource );
       ClassLoader dateClassLoader = Date.class.getClassLoader();
       System.out.println( "dateClassLoader: " + dateClassLoader );
       URL dateResource = Date.class.getResource( "/java/util/Date.betwixt"
);
       System.out.println( "dateResource: " + dateResource );

   }
}

When running this class through IntelliJ, the output is:

classLoader: [EMAIL PROTECTED]
resource:
file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
dateClassLoader: null
dateResource:
file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt

However, when using surefire, I get:

classLoader: [EMAIL PROTECTED]
resource:
file:/C:/javatests/surefire-test/target/classes/java/util/Date.betwixt
dateClassLoader: null
dateResource: null


any ideas?

regards,

Wim

Reply via email to