Testcase: testCalculateNeed(com.fluide.procurement.processes.need.CalculateNeedBeanTest): Caused an ERROR [junit] Cannot subclass final class class com.fluide.common.util.DateUtil [junit] java.lang.IllegalArgumentException: Cannot subclass final class class com.fluide.common.util.DateUtil [junit] at org.mockito.cglib.proxy.Enhancer.generateClass(Enhancer.java:447) [junit] at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) [junit] at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217) [junit] at org.mockito.cglib.proxy.Enhancer.createHelper(Enhancer.java:378) [junit] at org.mockito.cglib.proxy.Enhancer.createClass(Enhancer.java:318) [junit] at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:93) [junit] at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:50) [junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:100) [junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:58) [junit] at org.powermock.api.mockito.PowerMockito.spy(PowerMockito.java:229)
Si je lance avec un run sous jdevelopper j'ai pas ce problème. NB Les class PowerMockito génére des class à l'exécution.
Marsh Posté le 08-07-2011 à 16:10:50
Bonjour
Je fais un script junit qui lance des test à partir de jar .class, il ne fais pas la compilation. J'ai vérifié qu'il y a tous les packages.
<target name="test">
<mkdir dir="Creports" />
<junit>
<classpath>
<fileset dir="${project.dir.lib.jdevelopper}">
<include name="*.jar" />
</fileset>
<fileset dir="${project.dir.lib.jdevelopper.ejb}">
<include name="*.jar" />
</fileset>
<fileset dir="${project.dir.lib.shared}">
<include name="*.jar" />
</fileset>
<fileset dir="${project.dir.lib.common}">
<include name="*.jar" />
</fileset>
<fileset dir="${project.dir.lib.common.lib}">
<include name="*.jar" />
</fileset>
<pathelement path="${project.dir.class}" />
</classpath>
<formatter type="brief" usefile="false" />
<formatter type="xml"/>
<batchtest todir="Creports">
<fileset dir="${project.dir.class}" includes="**/*Test*.class" excludes="**/${project.dir.class.exclude}.*" />
</batchtest>
</junit>
</target>
Testcase: testCalculateNeed(com.fluide.procurement.processes.need.CalculateNeedBeanTest): Caused an ERROR
[junit] Cannot subclass final class class com.fluide.common.util.DateUtil
[junit] java.lang.IllegalArgumentException: Cannot subclass final class class com.fluide.common.util.DateUtil
[junit] at org.mockito.cglib.proxy.Enhancer.generateClass(Enhancer.java:447)
[junit] at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
[junit] at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
[junit] at org.mockito.cglib.proxy.Enhancer.createHelper(Enhancer.java:378)
[junit] at org.mockito.cglib.proxy.Enhancer.createClass(Enhancer.java:318)
[junit] at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:93)
[junit] at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:50)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:100)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:58)
[junit] at org.powermock.api.mockito.PowerMockito.spy(PowerMockito.java:229)
Si je lance avec un run sous jdevelopper j'ai pas ce problème. NB Les class PowerMockito génére des class à l'exécution.
??????????????????