Closed GoogleCodeExporter closed 9 years ago
I downgrade Powermock from 1.4.7 to 1.4.6 and this error does NOT exist any
more.
It looks like a bug exists in Powermock 1.4.7.
Original comment by michal.r...@gmail.com
on 17 Jan 2011 at 9:56
I'm seeing the exact same behavior.
I have 37 tests in my power-mock'ed test case, and some (usually 1 or 2, always
different ones) fail randomly on the same stubbing code in @Before.
Thanks for the downgrade hint, will try that.
Original comment by matth...@qype.com
on 24 Jan 2011 at 12:43
Yep, I can confirm that everything checks out just fine with 1.4.6. Must be a
regression in 1.4.7 then?
Original comment by matth...@qype.com
on 24 Jan 2011 at 12:46
Confirming this bug, tests are randomly failing.
I think it is related to @PrepareForTest annotation, tests without this
annotation look stable.
Original comment by crudolf....@googlemail.com
on 8 Feb 2011 at 1:06
This is something we need to look into. Seems like a race condition (finalize
method should never be proxied) but I find it hard to see why it should work in
1.4.6 and not 1.4.7.
Original comment by johan.ha...@gmail.com
on 9 Feb 2011 at 10:22
I have a similar issue with mocking a static with a side effect (shouldn't get
called) using the special syntax:
doReturn(returnValue).when(MyStatic.class);
MyStatic.doSomething();
It also works intermittently (most of the times it works, but every few runs
I'll get an error because it's calling the real static method which is not
designed to be called in the test environment.
Could these issues be related? I will try downgrading to 1.4.6 and see if it
also resolves it.
Original comment by dtabu...@gmail.com
on 25 Feb 2011 at 2:35
This has now been fixed in trunk (r1574). The reason why this happened was
because the mock instance wasn't referenced long enough in some cases which
caused it to be GC:ed znd thus the finalize method was called. We had a similar
issue with EasyMock some years ago which was resolved but we obviously forgot
about patching the Mockito extension as well.
The issue could occur in PowerMock 1.4.6 as well so it's not a 1.4.7 related
issue.
Original comment by johan.ha...@gmail.com
on 25 Feb 2011 at 9:45
Thanks Johan, great work as always.
Original comment by matth...@qype.com
on 25 Feb 2011 at 9:55
maybe it's worth pushing out a release for this?
Original comment by davidkar...@gmail.com
on 25 Feb 2011 at 9:58
I agree it's fairly critical, should warrant a maintenance release
Original comment by matth...@qype.com
on 25 Feb 2011 at 10:02
Yeah maybe it's time to make a new release. I'll see if I can find some time
for it during the weekend.
Original comment by johan.ha...@gmail.com
on 25 Feb 2011 at 10:06
And if someone would like to verify that it actually works that would be really
nice.
Original comment by johan.ha...@gmail.com
on 25 Feb 2011 at 10:07
is there a workaround for this until a release becomes available?
Original comment by schauder...@gmail.com
on 25 Feb 2011 at 12:05
Not that I can think of :(
Original comment by johan.ha...@gmail.com
on 25 Feb 2011 at 12:40
I've released 1.4.8 now. Please tell me if it works for you or not.
Original comment by johan.ha...@gmail.com
on 26 Feb 2011 at 9:46
Seems to work fine so far
Original comment by davidkar...@gmail.com
on 28 Feb 2011 at 1:28
Great!
Original comment by johan.ha...@gmail.com
on 28 Feb 2011 at 1:43
Works fine for a class from my bug report. And also works fine for the project
when I first found the bug.
Original comment by michal.r...@gmail.com
on 28 Feb 2011 at 1:55
Original issue reported on code.google.com by
michal.r...@gmail.com
on 14 Jan 2011 at 3:52