Open GoogleCodeExporter opened 9 years ago
I don't know Groovy but I suppose you would get the same exception in pure
Java? I
have so much to do right now so it would really help if I could get a java
example
instead. It's possible that it is a Javassist issue as well..
Original comment by johan.ha...@gmail.com
on 16 Feb 2010 at 2:07
You could try upgrading to Javassist 3.11 and see if you still get the same
result.
Original comment by johan.ha...@gmail.com
on 16 Feb 2010 at 2:40
Hi Johan,
I don't believe the problem exists with a straight-java test. I have attached an
updated test case that includes a passing java test.
Please find in the attached two separate groovy tests, one
(GroovyPowermockWithoutIgnoreTest) that demonstrates the failure that results
when
calling getClass() and the other (GroovyPowermockWithIgnoreTest) demonstrates
that
using the following annotation causes the getClass() to work without problem:
@PowerMockIgnore(['org.codehaus.groovy', 'groovy.lang'])
I am unable to update the test case to depend on 3.11.0.GA of javassist because
they
have not published that artifact to the public maven repository. As the pom is
set up
now, it will just transitively grab whatever javassist version that the
powermock
dependency declares.
Original comment by nerd4chr...@gmail.com
on 17 Feb 2010 at 5:25
Attachments:
I am encountering the same issue. Mockito does not appear to have any problems
so I'm
curious as to if it might be related to the RunWith and PrepareForTest
annotations.
Original comment by samueldo...@gmail.com
on 23 Mar 2010 at 2:19
One more thing, seeing how there is a growing tendency to write tests using
Groovy
over Java this defect should probably be raised to a higher level of severity.
Original comment by samueldo...@gmail.com
on 23 Mar 2010 at 2:21
I agree, however I have very little experience with groovy myself so it would
be
really good if someone could help out tracking this down.
Original comment by johan.ha...@gmail.com
on 23 Mar 2010 at 7:23
It appears to be purely an issue with javassist being unable to serialize
groovy class files to byte arrays. Attached is a JUnit test proving it can be
reproduced without having powermock in the mix. This is using
javassist-3.14.0-GA.
Original comment by mahoney...@gmail.com
on 23 May 2011 at 9:20
Attachments:
I have raised an issue on javassist here:
https://issues.jboss.org/browse/JASSIST-142
Original comment by mahoney...@gmail.com
on 23 May 2011 at 9:37
Thanks for your help!
Original comment by johan.ha...@gmail.com
on 24 May 2011 at 6:32
Manually specifying org.javassist:javassist:3.15.0-GA as the javassist version
fixes this issue.
Original comment by mahoney...@gmail.com
on 15 Jan 2012 at 9:12
Thanks for letting us know.
Original comment by johan.ha...@gmail.com
on 16 Jan 2012 at 8:48
[deleted comment]
Which version of javaassist is compatible with latest powermock 1.5 ? I have
used 3.15.0-GA and I am getting the below error :
java.lang.VerifyError: (class: org/powermock/modules/agent/JDK6AgentLoader,
method: getVirtualMachineImplementationFromEmbeddedOnes signature:
()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
at org.powermock.modules.agent.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:40)
at org.powermock.modules.agent.PowerMockAgent.initializeIfNeeded(PowerMockAgent.java:91)
at com.csfb.primeview.workspace.WorkSpaceECPTest.<clinit>(WorkSpaceECPTest.java:39)
at sun.reflect.GeneratedSerializationConstructorAccessor21.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:40)
at org.powermock.reflect.internal.WhiteboxImpl.newInstance(WhiteboxImpl.java:229)
at org.powermock.reflect.Whitebox.newInstance(Whitebox.java:139)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:123)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.clone(DeepCloner.java:82)
at org.powermock.classloading.DeepCloner.clone(DeepCloner.java:69)
at org.powermock.classloading.ClassloaderExecutor.execute(ClassloaderExecutor.java:89)
at org.powermock.classloading.ClassloaderExecutor.execute(ClassloaderExecutor.java:78)
at org.powermock.modules.junit4.rule.PowerMockStatement.evaluate(PowerMockRule.java:49)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Also, since there are so many jars involved with javaassist - it would be nice
if all the versions of related library are listed at one single place. There is
an initial attempt to do that - but, there are extensions like PowerMockRule. I
have spent more than a complete day to integrate PowerMock with Mockito - but,
I am still not able to see that green bar in Junit console. Oscillating from
fixing one stack trace to other. So far, I have these powermock libraries in my
classpath :
mockito-all-1.9.5-rc1.jar
objenesis-tck-1.3.jar
powermock-module-junit4-rule-1.5.jar
powermock-module-junit4-rule-agent-1.5.jar
powermock-module-javaagent-1.5.jar
powermock-mockito-1.5-full.jar
powermock-classloading-base-1.5.jar
powermock-classloading-objenesis-1.5.jar
javassist-3.15.0-GA.jar
powermock-api-support-1.5.jar
I am using Spring 3 and Junit 4.8.2.
Request to anyone in Powermock community :
If a test case to test static method in Spring 3 ecosystem is working - with
PowerMockAgent and PowerMockRule : please share the libraries and the
corresponding version you are using.
Thanks,
Goverdhan
Original comment by Goverdha...@gmail.com
on 16 May 2013 at 1:57
PLease upgrade to the latest version of Javassist and see if you get the same
error, 3.15 is really old.
Original comment by johan.ha...@gmail.com
on 17 May 2013 at 4:57
Upgraded to javassist-3.17.1-GA.jar .. still the same error. Thanks.
Original comment by Goverdha...@gmail.com
on 20 May 2013 at 10:54
[deleted comment]
There are examples of using the both the classloader and agent based
PowerMockRule in the example projects in the SVN repo. Don't think they use
Spring 3 though, but not sure if Spring is really the problem.
Original comment by johan.ha...@gmail.com
on 21 May 2013 at 9:25
Johan - Thanks for the reply. The problem is my company does not allow me to
connect connect to your SVN, perhaps for firewall security reasons. I have
deleted all the previous jars from my classpath and downloaded the dependency
jars from
http://code.google.com/p/powermock/downloads/detail?name=powermock-mockito-testn
g-1.5.zip&can=2&q=
Added them at the top of my .classpath file and And added -
powermock-module-junit4-rule-1.5.jar
powermock-module-junit4-rule-agent-1.5.jar
powermock-module-javaagent-1.5.jar
powermock-classloading-base-1.5.jar
powermock-classloading-objenesis-1.5.jar
Done the regular clean-build. Surprisingly, I continue to see the same error. I
am running out of ideas. Please let me know if there is a ziped project with
all the jars and sample code available. Thanks again.
Original comment by Goverdha...@gmail.com
on 21 May 2013 at 2:41
Can't you checkout the source when you're home?
Original comment by johan.ha...@gmail.com
on 22 May 2013 at 6:27
For now, I have given up on working with PowerMockAgent and PowerMockRule. They
were required because I was running my test case with Spring i.e with
@RunWith(SpringJUnit4ClassRunner.class)
I am able to get a standalone PowerMock testcase working : but only after I
have removed PowerMockAgent/PowerMockRule and related jar files - and when I
run my testcase with @RunWith(PowerMockRunner.class) which obviously means I
can't use @RunWith(SpringJUnit4ClassRunner.class).
But, seeing the standalone PowerMock testcase working was a good first step and
I must thank Johan for sharing his wonderful work. Would look forward to see
more updates around this.
Original comment by Goverdha...@gmail.com
on 22 May 2013 at 11:20
Thanks! Both rule implementations are experimental and some problems are bound
to happen if the environment is complex. But I've always managed to resolve the
issues I've had personally so far :)
Original comment by johan.ha...@gmail.com
on 22 May 2013 at 11:46
Original issue reported on code.google.com by
nerd4chr...@gmail.com
on 16 Feb 2010 at 2:25