How to use JUnitDoclet with IntelliJ IDEA
=========================================

 1. Installation as ANT target
 2. Installation as external tool
 3. Hints specific for IDEA


1. Installation as ANT target
-----------------------------
Since ANT is not specific to IDEA, we described the installation
for ANT in a different file. 
Please see: ../../ant_target/readme.txt  


2. Installation as external tool
--------------------------------
This section describes, how you can install JUnitDoclet as
external tool. Please note, that this is not an integration
as smooth as with a plugin but it is working for IDEA 2.6
and 3.0 as well.

The benefit of this way is the independence from _all_ IDEs,
so you can change your IDE during development or develop in
a team with other people using different IDEs.

This installation procedure is just an example. There may be
much better ways to write the scripts. Anyway, they will get
you started and that's the primary goal.

The batch/script files are generic. They are not specific to
IDEA. So they don't use all the features of IDEA. For almost
all options, there are defaults set in
run_junitdoclet_setenv.(bat|sh).

    
    1. Copy the following five files to a single directory which is in
       the path.
     
         JUnitDoclet.jar
         packagelister.jar
         run_junitdoclet_setenv.bat    or run_junitdoclet_setenv.sh
         run_junitdoclet.bat           or run_junitdoclet.sh
         run_junitdoclet_recursive.bat or run_junitdoclet_recursive.sh
    
       If you are working on a Unix System, don't forget to make the
       scripts readable and executable ( chmod +rx run_junitdoclet* ).
    
    2. Adapt the custom area in run_junitdoclet_setenv.(bat|sh)
       Especially the INSTALL_DIRECTORY needs to be set.
     
       The scripts will start in the project directory, so make
       the other pathes relative to project home.
    
    3. Copy JUnitDoclet.xml into the config/tools subdirectory of your
       IntelliJ IDEA installation directory.
     
       Or do the configuration manually:
     
         Name             : Generate TestCase
         Group            : JUnitDoclet
         Synchronize ...  : yes
         Program          : run_junitdoclet.bat
         Parameters       : $FilePathRelativeToProjectRoot$
                            $SourcepathEntry$ -buildall
                            "$Classpath$" $JDKPath$
         Working Directory: $Projectpath$          
    
       and
    
         Name             : Generate TestSuite and sub tests
         Group            : JUnitDoclet
         Synchronize ...  : yes
         Program          : run_junitdoclet_recursive.bat
         Parameters       : $FilePackage$
                            $SourcepathEntry$ -buildall
                            "$Classpath$" $JDKPath$
         Working Directory: $Projectpath$          
    
       On a Unix system, please use run_junitdoclet.sh and
       run_junitdoclet_recursive.sh instead of the batch files
       and use full pathes.
        
    4. Start IntelliJ IDEA and open a Java file of your project, right
       click and select
         "JUnitDoclet" -> "Generate TestCase" or
         "JUnitDoclet" -> "Generate TestSuite and sub tests"
    
    5. If you are using ANT from IntelliJ IDEA 3.0 you must activate the option
       "Run under custom JDK" in the "built properties"-dialog.
    
    6. Enjoy regenerating the TestSuites and TestCases as part of
       Refactoring your application, but don't forget to write
       the tests. Still, this is your job, JUnitDoclet is "only"
       supporting you. ;-)
    
3. Hints specific for IDEA
---------------------------
 * If you are using IDEA 3.0, please execute ANT with custom JDK.
   (Build-FileProperties -> Execution) 

 * In the EAP-releases a few builds before 3.0 the way external
   tools are executed was changed. Please not, the scripts are
   ment for use with IDEA 3.0. 
   
 * If you get an warning 
   "TestCase com.foo.MyClassTest is invalid. It's not overwritten."
   you probably used the import optimization of IDEA for a 
   generated TestCase. Unfortunately IDEA removes comments between 
   imports as well, so the marker
     // JUnitDoclet begin import
   may be missing.  
   