Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Tycho + Powermock (mocking static)

Hi,

is it possible to use PowerMock [1] with Tycho?

After reading [2] and [3] I believe this might not be possible after all.

I wrapped PowerMock and its dependencies (Mockito, Junit, Javassist,...) in an Eclipse-Plugin and added this to my target and the dependencies of my plugin as well. When using the PowerMockRunner tycho-surefire does not find a Junit provider. I tried the agent/rule-based setup without success: Now tycho-surefire does not find my Tests...

Do I have to declare any frameworkExtensions in the tycho-surefire configuration?
If so, please point me to some nice examples of how to do this.

I need PowerMock to mock some static methods of a framework that I have to use. I see no way how I could refactor my code so that I can Test it with Junit and Mockito only.
I need to get the returnvalue of the method as a mockobject.
Sure I could wrap the call but at some point I will need to test the wrapped call so why bother wrapping it in the first place...

If using powermock is not possible: is my usecase invalid? Is there always a way to work around using mocks for static methods?
Otherwise I would request this as a new feature for tycho.

Thanks,
Jörg

[1] http://code.google.com/p/powermock/
[2] https://issues.jboss.org/browse/TEIIDDES-802
[3] https://groups.google.com/forum/#!topic/powermock/HjiWCsvTayw



Back to the top