Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-346

build failure when there is any class with name matching the test pattern, but is not a testcase

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3
    • 2.4
    • None
    • None

    Description

      When there is a class (or classes) that match the name pattern (Test* ou *Test), but it is not a testcase, like for example a helper class or a mock, the plugin tries to instantiate it.

      The plugin could check if the class is assignable to a test case prior trying to instantiate it.

      [INFO] [surefire:test]
      [INFO] Surefire report directory: c:\views\Clearing_1.0\GSUP2\Clearing\Implementacao\ctup-web-app\target\surefire-reports
      org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTest'; nested exception is java.lang.InstantiationException: br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTest; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTest'; nested exception is java.lang.InstantiationException: br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTestorg.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTest'; nested exception is java.lang.InstantiationException: br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTest
      java.lang.InstantiationException: br.com.cpqd.ctup.batch.cdrinterno.filtros.FonteDadosTest
      at java.lang.Class.newInstance0(Class.java:340)
      at java.lang.Class.newInstance(Class.java:308)
      at org.apache.maven.surefire.testset.PojoTestSet.<init>(PojoTestSet.java:55)
      at org.apache.maven.surefire.junit.JUnitDirectoryTestSuite.createTestSet(JUnitDirectoryTestSuite.java:64)
      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
      at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:150)
      at org.apache.maven.surefire.Surefire.run(Surefire.java:111)
      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:597)
      at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.j
      ava:818)
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE

      Attachments

        Activity

          People

            Unassigned Unassigned
            dcreado Domingos Creado
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: