Open GoogleCodeExporter opened 9 years ago
PowerMock's main intention is to be used in unit tests where you want to
isolate the
code under test from an environment. What you're probably doing is an
integration
test. Never the less it would be nice to get it working so I'll add it as an
enhancement request
Original comment by johan.ha...@gmail.com
on 11 Sep 2009 at 10:03
It's not an integration test, the class i want to test is a Spring bean in our
application.
I manage to resolve this by using Default constructor and set manually all
necessary
properties.
Yes, it would be an enhancement, less work for the same result, I suppose it
requires
a Spécifique runner "Spring compatible". Like @RunWith(
SpringJUnit4ClassRunner.class
), allowing the use of injection. But it's a quite complicated for me when it
comes
to JVM consideration...
Original comment by souquier...@gmail.com
on 11 Sep 2009 at 3:32
Hmm.. Could you create an example that demonstrates the issue?
Original comment by johan.ha...@gmail.com
on 17 Mar 2010 at 7:22
Is this enhancement done?
I intend to use PowerMockito's static mocking capability in integration tests
ran
with SpringJunit4ClassRunner...
Original comment by eva.mukh...@gmail.com
on 26 May 2010 at 7:49
Try the PowerMockRule, that's the only viable option right now that I can think
of.
Original comment by johan.ha...@gmail.com
on 26 May 2010 at 8:14
There are some really odd issues with running Spring Integration tests and
PowerMock.
I'm using TestNG with a suite.xml file and just having PowerMock scanned in the
classpath is doing something odd.
Original comment by samueldo...@gmail.com
on 4 Oct 2010 at 8:28
What do you mean by "just having PowerMock scanned ..."?
Are you using the rule?
Original comment by johan.ha...@gmail.com
on 5 Oct 2010 at 10:42
I probably run into the same issue, using spring's runner with PowerMockRule.
I want to create a static mock for slf4j LoggerFactory in a spring test, and I
get "cannot subclass final class LoggerFactory".
If I remove the spring runner and use the PowerMock runner instead of the rule,
the mock is created properly.
Original comment by dietrich...@gmail.com
on 15 Nov 2010 at 6:40
We have plans to make a second version of the PowerMock rule that uses e.g.
XStream as deep-cloner instead of in-memory Objenesis state cloning which
unfortunately is not very stable. I'm not sure if it'll solve your problem
though, it could be that you may need to depend on the @PowerMockIgnore
annotation...
Original comment by johan.ha...@gmail.com
on 15 Nov 2010 at 7:31
Thank you for your answer. What would I have to ignore then?
Original comment by dietrich...@gmail.com
on 15 Nov 2010 at 3:32
I've recently created a new project called powermock-module-junit4-agent which
bootstraps using a javaagent instead of classloaders. Please help us by
checking out PowerMock from trunk and try if the new project works for you.
Depend on:
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule-agent</artifactId>
<version>1.4.9-SNAPSHOT</version>
in Maven. Then you use the @PowerMockRule as usually:
@Rule
public PowerMockRule powermock = new PowerMockRule();
Original comment by johan.ha...@gmail.com
on 10 Apr 2011 at 1:00
I'm really hope this issue will be fixed on next release, please.
Original comment by keanu.p...@gmail.com
on 6 Jul 2012 at 5:31
Original issue reported on code.google.com by
souquier...@gmail.com
on 11 Sep 2009 at 7:28