Since PowerMock 1.0 suppression of methods returning String returns "". Is
this really correct? Strings can be treated as Object and thus can return
null. This was the behavior in previous versions of PowerMock and this is
also the behavior when stubbing methods in Mockito. This now leads to very
strange results, e.g. let's say you have a method called A which is not
final. Stubbing this method will return null because it is not intercepted
by the MockGateway (because it's not final or static?) and goes to Mockito
directly. Changing the modifier to final will trigger the MockGateway to
intercept the call and return "" instead since the call should be suppress
when in verification mode in mockito. So the question is, should we
intercept the call to standard methods and always return "" or should we
return null? Not returning null would yeild strange results when using
PowerMockito as a substitute for Mockito.
See SimpleStaticInitializerExample#getConcatenatedString for an example
(remove the final modifier and see how the test reacts).
Original issue reported on code.google.com by johan.ha...@gmail.com on 3 Dec 2008 at 9:23
Original issue reported on code.google.com by
johan.ha...@gmail.com
on 3 Dec 2008 at 9:23