I've been wondering the best practice of implementing unit test in
play. Looking at how the injection from spring ioc or guice works,
where it injects dependency classes to static field, I belief I would
be needing powermock to mock all those static classes.
The problem is I just couldn't make powermock to run.
Here is my dependency.yml :
- play
- play -> db 1.1.1
- play -> mockito 0.1
- net.htmlparser.jericho -> jericho-html 3.2:
transitive: false
- org.powermock -> powermock-module-junit4 1.4.10
- org.powermock -> powermock-api-mockito 1.4.10:
exclude:
- org.mockito -> mockito-all
When using the powermock in the tests I got this exception :
java.lang.ClassNotFoundException: utils.photograbber.TestServiceTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:143)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
Anyone can help? Or is there any best practice to do unit test (isolated tests)
regards.
Aviandri
Can you send me sample project?
Grzegorz Slowikowski
Thx
2011/12/13 Grzegorz Słowikowski <gslowi...@gmail.com>:
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/HweNcYh1HxMJ.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.