[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [tycho-user] Tycho + Powermock (mocking static)
|
Hi,
I have never tried PowerMock, but Mockito works for us. However, there were two stumbling stones that may be relevant to you. Firstly, surefire has a bug [1], which we worked around by adding Import-Package:org.junit.runner to MANIFEST.MF [2]. Secondly, Mockito does require presence of a JDK, and once a person tries to build and run tests with JRE on his path, it fails with some weird class-not-found exception. We solved this issue by using Maven Toolchains. So, check if you are being hit by any of these issues.
[1] http://jira.codehaus.org/browse/SUREFIRE-825
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=369266
/Mikhail
----- Ursprungligt meddelande -----
Från: "Jörg Sesterhenn" <Joerg.Sesterhenn@xxxxxxxxx>
Till: tycho-user@xxxxxxxxxxx
Skickat: tisdag, 19 nov 2013 15:33:34
Ämne: [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
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user