Closed GoogleCodeExporter closed 8 years ago
You cannot prepare a class that is also ignored. That's the problem.
Original comment by johan.ha...@gmail.com
on 6 Nov 2012 at 5:41
But in the JavaDoc of PowerMockIgnore class, it says clearly,
"Note that the PrepareForTest and PrepareOnlyThisForTest will have precedence
over this annotation (PowerMockIgnore)."
So I expect if the class appears both in @PrepareForTest in @PowerMockIgnore,
the class should get mocked.
To give you more background knowledge, I'm actually writing test cases where a
final class belonging to Eclipse framework need be mocked. But at the same
time, I have to add @PowerMockIgnore("org.eclipse.*") to not break the
initialization of host plugin.
BTW, sorry I gave the wrong title, it should be "Failed to mock a final class
with both @PrepareForTest and @PowerMockIgnore set"
Original comment by shen.bin...@gmail.com
on 6 Nov 2012 at 6:12
Oh I have forgotten about that, sorry. In that case it ought to work I suppose.
It seem logical that PrepareForTest should have precedence over
PowerMockIgnore. I'll see if I can reproduce it.
Original comment by johan.ha...@gmail.com
on 6 Nov 2012 at 6:31
Yes this was indeed a bug and I wonder why no one has discovered this before
(including myself :)).
I've pushed the changes to trunk so please try it out if you like by building
PowerMock from source (ignore the tests if you're using Java 7).
Original comment by johan.ha...@gmail.com
on 6 Nov 2012 at 7:26
Cool! I'll give it a try and get back here. Thanks!
Original comment by shen.bin...@gmail.com
on 6 Nov 2012 at 7:37
Verified in latest 1.5 version. Good job!
Original comment by shen.bin...@gmail.com
on 14 Dec 2012 at 1:57
great :)
Original comment by johan.ha...@gmail.com
on 14 Dec 2012 at 2:02
Original issue reported on code.google.com by
shen.bin...@gmail.com
on 15 Oct 2012 at 1:48Attachments: