You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stephen Coy (JIRA)" <ji...@codehaus.org> on 2007/02/19 08:11:52 UTC

[jira] Created: (SUREFIRE-288) Surefire tries to instantiate nested TestCase classes

Surefire tries to instantiate nested TestCase classes
-----------------------------------------------------

                 Key: SUREFIRE-288
                 URL: http://jira.codehaus.org/browse/SUREFIRE-288
             Project: Maven Surefire
          Issue Type: Bug
          Components: JUnit 3.x support, Junit 4.x support
    Affects Versions: 2.0 (2.2 plugin)
         Environment: Windows XP, Java 1.4.2
            Reporter: Stephen Coy


If a JUnit TestCase contains any kind of nested class (static or not), Surefire feels obliged to try and instantiate it. This will fail with access violations if the class is not public.

Work around seems to be to make the nested class public, but surely Surefire has no business doing this anyway?

Here is a sample stack trace:

org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
        at java.lang.Class.newInstance0(Class.java:293)
        at java.lang.Class.newInstance(Class.java:261)
        at org.apache.maven.surefire.testset.PojoTestSet.<init>(PojoTestSet.java:52)
        at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:61)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:93)
        at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-288) Surefire tries to instantiate nested TestCase classes

Posted by "Karl Wettin (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_98135 ] 

Karl Wettin commented on SUREFIRE-288:
--------------------------------------

I just hit this.

Could not find anything about it, so I just excluded all inner classes:

{code:xml} 
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                    	<exclude>**/*$*</exclude>
                    </excludes>                    	
                </configuration>
            </plugin>
{code}  

I know this is not the forum, but as you notice I'm already at it: it would be nice if I could configure Surefire to what combinations of test scemes (ng, junit, pojo) to run. I need to exclude a lot of pojos now..

> Surefire tries to instantiate nested TestCase classes
> -----------------------------------------------------
>
>                 Key: SUREFIRE-288
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-288
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 3.x support, Junit 4.x support
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: Windows XP, Java 1.4.2
>            Reporter: Stephen Coy
>             Fix For: 2.4
>
>
> If a JUnit TestCase contains any kind of nested class (static or not), Surefire feels obliged to try and instantiate it. This will fail with access violations if the class is not public.
> Work around seems to be to make the nested class public, but surely Surefire has no business doing this anyway?
> Here is a sample stack trace:
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
>         at java.lang.Class.newInstance0(Class.java:293)
>         at java.lang.Class.newInstance(Class.java:261)
>         at org.apache.maven.surefire.testset.PojoTestSet.<init>(PojoTestSet.java:52)
>         at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:61)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:93)
>         at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
>         at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
>         at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (SUREFIRE-288) Surefire tries to instantiate nested TestCase classes

Posted by "Dan Fabulich (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Fabulich closed SUREFIRE-288.
---------------------------------

       Resolution: Duplicate
    Fix Version/s:     (was: 2.4)

Duplicate of surefire-44, fixed and integration tested.

> Surefire tries to instantiate nested TestCase classes
> -----------------------------------------------------
>
>                 Key: SUREFIRE-288
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-288
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 3.x support, Junit 4.x support
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: Windows XP, Java 1.4.2
>            Reporter: Stephen Coy
>
> If a JUnit TestCase contains any kind of nested class (static or not), Surefire feels obliged to try and instantiate it. This will fail with access violations if the class is not public.
> Work around seems to be to make the nested class public, but surely Surefire has no business doing this anyway?
> Here is a sample stack trace:
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
>         at java.lang.Class.newInstance0(Class.java:293)
>         at java.lang.Class.newInstance(Class.java:261)
>         at org.apache.maven.surefire.testset.PojoTestSet.<init>(PojoTestSet.java:52)
>         at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:61)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:93)
>         at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
>         at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
>         at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SUREFIRE-288) Surefire tries to instantiate nested TestCase classes

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated SUREFIRE-288:
----------------------------------

    Fix Version/s: 2.3

> Surefire tries to instantiate nested TestCase classes
> -----------------------------------------------------
>
>                 Key: SUREFIRE-288
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-288
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 3.x support, Junit 4.x support
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: Windows XP, Java 1.4.2
>            Reporter: Stephen Coy
>             Fix For: 2.3
>
>
> If a JUnit TestCase contains any kind of nested class (static or not), Surefire feels obliged to try and instantiate it. This will fail with access violations if the class is not public.
> Work around seems to be to make the nested class public, but surely Surefire has no business doing this anyway?
> Here is a sample stack trace:
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
>         at java.lang.Class.newInstance0(Class.java:293)
>         at java.lang.Class.newInstance(Class.java:261)
>         at org.apache.maven.surefire.testset.PojoTestSet.<init>(PojoTestSet.java:52)
>         at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:61)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:93)
>         at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
>         at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
>         at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SUREFIRE-288) Surefire tries to instantiate nested TestCase classes

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated SUREFIRE-288:
----------------------------------

    Fix Version/s:     (was: 2.3)
                   2.4

> Surefire tries to instantiate nested TestCase classes
> -----------------------------------------------------
>
>                 Key: SUREFIRE-288
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-288
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 3.x support, Junit 4.x support
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: Windows XP, Java 1.4.2
>            Reporter: Stephen Coy
>             Fix For: 2.4
>
>
> If a JUnit TestCase contains any kind of nested class (static or not), Surefire feels obliged to try and instantiate it. This will fail with access violations if the class is not public.
> Work around seems to be to make the nested class public, but surely Surefire has no business doing this anyway?
> Here is a sample stack trace:
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent'; nested exception is java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
> java.lang.InstantiationException: au.com.optus.eFulfilment.sap.test.moduleTest.TestSapOrderComponent$MySapOrderComponent
>         at java.lang.Class.newInstance0(Class.java:293)
>         at java.lang.Class.newInstance(Class.java:261)
>         at org.apache.maven.surefire.testset.PojoTestSet.<init>(PojoTestSet.java:52)
>         at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:61)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:93)
>         at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
>         at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
>         at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira