There is a Cube class. His absolute path: D:/My_projects/my_project/src/main/java/com/Cube.java
There is a method there:
public double get_volume() { ... }
There is a JUnit Test to check the code - Test_cube His absolute path: D:/My_projects/my_project/src/test/java/com/Test_cube.java
There is a method there:
@Test
public void get_volume() { ... }
The question is: is it possible to make the @see tag from the JavaDoc in the Cube class refer to a test method?
That's what we have now:
/**
* @see com.Test_cube#get_volume()
*/
public double get_volume() { ... }
I wrote it that way, and it doesn't link. @see looks just like text, not a link. If I write src.test.java.Test_cube#get_volume(), then nothing will happen. That is, as if you can't do this in JavaDoc, refer to methods in other packages
Code in test
depends on code in main
, not the other way around. This among other things, makes it impossible for your main
code to accidentally reference to or depend on test
code. This also means that code in main
cannot link to code in test
through Javadoc.
In other words, what you want is not possible, and shouldn't be possible.
As an aside, the main purpose of Javadoc is to be able to generate HTML documentation, and doing what you're trying to do would require to merge the Javadoc of the test classes with those of the main classes, which is not what you - generally - want. The javadoc
tool itself would make it possible to do this for generating the HTML, by pointing to both main
and test
as the location of sources (using -source-path
), but your IDE itself will not entertain this possibility for the reasons stated above.