This plugin generates JUnit tests from right click 'Generate...' menu while focused on a java class. The unit test output code can be customized using a provided velocity template to format the code based on the origin class.
If a unit test is created where one already exists, the user is prompted for overwrite or merge operation. The merge operation allows the user to selectively create the target file content.
A future revision will allow the user to generate their own test case macros.
Recent change notes
Re-releasing with java 1.6 compatibility. Previous release was for 1.7+
General usage instructions
This plugin was originally written by: Alex Nazimok. I have updated JUnit Generator and made it much more customizable.
This plugin allows users to generate customized test-case skeletons in a specified directory, which it will create if the directory does not already exist.
A velocity template is used to generate these test cases which can be customized as needed. These templates have access to a large amount of metadata making the generated tests very dynamic.
Several options are allowed, including the ability to decide whether or not to generate tests for all overloads of a method and how to name them. Also, for all private methods boiler plate reflection access and invocation code is created.
A test can be easily generated by pressing Alt+Ins and selecting JUnit Test or you can optionally add a keybinding to it under the keymap part of the IntelliJ settings page.
This plugin runs out of the box for IntelliJ 7, and will run fine in IntelliJ 6.x, however since there are version issues between the IntelliJ IDEA 6 and IntelliJ IDEA 7 SDK's, I have uploaded two versions, 2.0.6 and 2.0.7 respectively. If you download this plugin through IntelliJ you will get the 2.0.7 Version which runs on IntelliJ 7.x, however if you download the 2.0.6 version here, you only need to extract the junitgen.jar from the zip file and place it in the IntelliJ plugins folder, located under the config folder in 'Documents and Settings' in order to run this on IntelliJ 6.x
I have added JUnitGeneratorV2.0 as a project on Google Code. There you will be able to find the IntelliJ 6 version and a version compiled specifically to run on a Macs. I have also uploaded the source code and instructions to compile it. You can find the Google Project here: http://code.google.com/p/junit-generator-v2/
Also, feel free to leave any comments or suggestions.
***Google Code Website: http://code.google.com/p/junit-generator-v2/