ruben
unread,Oct 26, 2010, 10:43:58 AM10/26/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to PowerMock
Hi,
when trying to run powermock tests with maven using
the surefire plugin, javassist class preparation fails.
The SimpleTest class is annotated with
@RunWith(PowerMockRunner.class)
@PrepareForTest( { TestEntity.class } )
The test works when running it in eclipse but using maven surefire
from commandline
fails with the following error:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.032
sec <<< FAILURE!
initializationError(com.example.SimpleTest) Time elapsed: 0.016 sec
<<< ERROR!
java.lang.IllegalStateException: Failed to transform class with name
com.example.TestEntity. Reason: bad array type for AALOAD: null
at
org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:
208)
at
org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:
146)
at
org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:
65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at
org.junit.internal.runners.TestClass.getAnnotatedMethods(TestClass.java:
44)
at
org.junit.internal.runners.MethodValidator.validateTestMethods(MethodValidator.java:
69)
at
org.junit.internal.runners.MethodValidator.validateStaticMethods(MethodValidator.java:
43)
at
org.junit.internal.runners.MethodValidator.validateMethodsForDefaultRunner(MethodValidator.java:
49)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.validate(PowerMockJUnit44RunnerDelegateImpl.java:
123)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:
85)
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl.<init>(PowerMockJUnit47RunnerDelegateImpl.java:
42)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:
513)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:
154)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:
49)
at
org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:
231)
at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:
69)
at
org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:
36)
at
org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:
27)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:
513)
at
org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:
31)
at
org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:
24)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:
57)
at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:
29)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:
57)
at
org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:
24)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:
45)
at
org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:
56)
Any idea what is wrong here?
Thanks for your help!
Regards,
Ruben