Maven, TestNG and Expected Exceptions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Maven, TestNG and Expected Exceptions

francois.meaude

Hello,

I am trying to run my test classes using TestNG (5.1) and Maven 2 and I
have a slight problem with the tag @testng.expected-exceptions.(I'm
using a JRE1.4)

If I use it with a standard Exception my tests succeed but if I use an
exception that I developed there is a class loader problem.

This test works fine
    /**
     * @testng.test
     * @testng.expected-exceptions
     * value = "java.lang.Exception"
     */
    public void reservationExceptionTest() throws Exception {

        throw new BQCMException();
    }

But this one fails and I get the following stack trace.
   /**
     * @testng.test
     * @testng.expected-exceptions
     * value = "org.euqos.client.qcm.bqcm.BQCMException"
     */
    public void reservationExceptionTest() throws Exception {

        throw new BQCMException();
    }


java.lang.ClassNotFoundException:
org.euqos.client.qcm.bqcm.BQCMException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at
org.testng.internal.annotations.Converter.getClassArray(Converter.java:58)

When I try to launch these tests in eclipse with the testNg plugin
(5.1), it works perfectly.

Has anyone encountered the same problem?

Thanks in advance.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---