Open GoogleCodeExporter opened 9 years ago
Thanks for reporting. The behavior of the PowerMockRule is quite complex and
it's hard to cover all the corner-cases. Perhaps what you need to do is to
ignore some packages for test that you suspect are creating the proxies (if
possible). If not I'm afraid you would have to help us out a bit and dig into
the PowerMock code and try to find a solution to the problem.
Original comment by johan.ha...@gmail.com
on 21 Oct 2011 at 6:18
Hi,
I have this issue too and i understand why:
At some moment PowerMock serialize the test class and Xstream cannot serialize
the ApplicationContext class from Spring(Proxy classe too and some others from
my experience.)
I try to make a patch but i do not understand why PowerMock deep clone some
classes. If you can explain me that, i think i could find a patch.
Thanks for your help.
Original comment by jackc...@gmail.com
on 21 Mar 2012 at 4:02
Hi Again,
After understood that the problem is about Serialization. I add the key-word
transient on attribute applicationContext and I run again the test to
discover that my test case is executed from the tests class cloned and by
consequence attribute applicationContext is null.
Can you explain me why tests cases is executed from the tests class cloned ?
Thanks in advance.
Original comment by jackc...@gmail.com
on 22 Mar 2012 at 10:27
You can try out the Javaagent based PowerMockRule and see if it makes any
difference.
Original comment by johan.ha...@gmail.com
on 26 Mar 2012 at 6:45
Jack,
Did you ever get around this issue?
I am having the exact same problem.
Thanks in advance.
Original comment by guitarg...@gmail.com
on 3 May 2012 at 9:20
Hi GuitarGice,
This week i try to use the powermockagent
(http://code.google.com/p/powermock/wiki/PowerMockAgent) and it solved my
problem.
Indeed my issue was that serialization has tried to serialize a huge object in
order to change where my huge instance is loaded. With powermockagent no more
serialization is needed by powermock to inject some source code and do its job.
The only constraint to use this agent is its demand some configuration. And if
you use eclipse + maven you have to configured eclipse to use the agent and
maven too. if you forgot one of them some tests will fail.
Original comment by jackc...@gmail.com
on 5 May 2012 at 6:06
[deleted comment]
Is this issue open yet ? I'm getting the same error =(
Any news ?
Thanks in advance!
Original comment by sandro.c...@gmail.com
on 30 Jun 2014 at 9:46
In my case i'm using:
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration({ "classpath:/WEB-INF/servlet.xml",
"classpath:/WEB-INF/security.xml" })
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
@PrepareForTest({ AccessLoginWebDatabase.class, AccessLoginWebDatabase.class })
public class AuthenticationControllerTestCase
Original comment by sandro.c...@gmail.com
on 30 Jun 2014 at 9:47
Original issue reported on code.google.com by
zhaoshan...@gmail.com
on 13 Oct 2011 at 3:46