Is there a simple way of creating stubs for Junit4 tests in Eclipse (Galileo)?
A:
If you want to create a stub implementation of an interface, then
- Create your stub class
- write
implements MyInterface
- click on the red icon on the left (or press CTRL+1) and choose "add unimplemented methods"
A more generic approach is, when you create your class, and add extends
/ implements
, go to Source > Override/Implement methods
. The downside is you will have to clear some super
calls.
Bozho
2009-12-12 18:46:32
+6
A:
Right click on a class/file in the package explorer, then new-> JUnit Test Case. Then a dialog opens and if you click the next button it allows you to check which methods to automatically create the stubs for.
Michael Patterson
2009-12-12 18:48:50
+1 thanks - that was what I was after.
peter.murray.rust
2009-12-12 18:57:39
+1
A:
You might also look into Fast Code Eclipse Plugin. Once you configure you can generate junit/testng test by selecting the class or any method. Also gives you way to navigate from a method to all the tests. The popup dialog doesn't appear every time.
fastcodejava
2009-12-15 17:53:43