views:

960

answers:

2

Most of our Eclipse projects have multiple source folders, for example:

  • src/main/java
  • src/test/java

When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the first source folder listed in the project properties).

Is there any way to change the default source folder for new JUnit tests, so that when I do the above action, the new test will be created in say the "src/test/java" folder by default?

+4  A: 

No.

Unless you change the plugin code, the default source folder is always the same as that containing the class you right clicked on (not necessarily the first source folder listed). I agree, it would be nice to be able to change it!

Dave L.
+5  A: 

I use moreUnit, an Eclipse plugin to assist writing unit tests. Among other features, it lets you configure the default source folder of tests.

pauxu
I'd vote you up but I'm out of votes for the next hour! :-)
Andrew Swan
moreunit looks awesome, thanks
matt b
Voted you up. Now I love moreUnit and couldn't live without my Ctrl-J to jump between the code and its test.
Andrew Swan