r/javahelp • • Mar 21 '25

Intellij: Add javadoc when generating test method

How can I add the javadoc from my main class method to the corresponding test method (for reference, possibly with editing)? Is there a way to do this through IntelliJ templates? I want to be able to reference what the method should be doing while looking at the tests. Regular methods have an option to inherit the javadoc from the interface/abstract class, but test methods don't (at least automatically).

I've looked at the intelliJ templates but there doesn't seems to be any pre-defined variables I can use.

Note: the specific use is for HW, but it would be useful anyways to know how to do it (which is why I didn't add the HW tag)

1 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/Awes12 Mar 23 '25

Yeah, that's a bit demonic lol. Also the return types would be an issue