test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java
changeset 49139 771616d26ca1
parent 48654 36f58bd6269f
child 50118 919c36db208c
equal deleted inserted replaced
49138:67912cbf784a 49139:771616d26ca1
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332
    26  * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332
       
    27  *      8182765
    27  * @summary A simple test to ensure class-use files are correct.
    28  * @summary A simple test to ensure class-use files are correct.
    28  * @author jamieh
    29  * @author jamieh
    29  * @library ../lib
    30  * @library ../lib
    30  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    31  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    31  * @build JavadocTester
    32  * @build JavadocTester
    82         );
    83         );
    83         checkOutput("pkg1/class-use/UsedClass.html", true,
    84         checkOutput("pkg1/class-use/UsedClass.html", true,
    84           "that return types with arguments of type"
    85           "that return types with arguments of type"
    85         );
    86         );
    86         checkOutput("pkg1/class-use/UsedClass.html", true,
    87         checkOutput("pkg1/class-use/UsedClass.html", true,
    87           "<a href=\"../C1.html#methodInC1ReturningType--\">methodInC1ReturningType</a>"
    88           "<a href=\"../C1.html#methodInC1ReturningType()\">methodInC1ReturningType</a>"
    88         );
    89         );
    89         checkOutput("pkg1/class-use/UsedInterface.html", true,
    90         checkOutput("pkg1/class-use/UsedInterface.html", true,
    90           "Classes in <a href=\"../package-summary.html\">pkg1</a> that implement " +
    91           "Classes in <a href=\"../package-summary.html\">pkg1</a> that implement " +
    91           "<a href=\"../UsedInterface.html\" title=\"interface in pkg1\">UsedInterface</a>"
    92           "<a href=\"../UsedInterface.html\" title=\"interface in pkg1\">UsedInterface</a>"
    92         );
    93         );
    99         );
   100         );
   100         checkOutput("pkg1/class-use/UsedInterface.html", true,
   101         checkOutput("pkg1/class-use/UsedInterface.html", true,
   101            "<a href=\"../AnAbstract.html\" title=\"class in pkg1\">AnAbstract</a>"
   102            "<a href=\"../AnAbstract.html\" title=\"class in pkg1\">AnAbstract</a>"
   102         );
   103         );
   103         checkOutput("pkg1/class-use/UsedInterface.html", true,
   104         checkOutput("pkg1/class-use/UsedInterface.html", true,
   104             "../C10.html#withReturningTypeParameters--"
   105             "../C10.html#withReturningTypeParameters()"
   105         );
   106         );
   106         checkOutput("pkg1/class-use/UsedInterface.html", true,
   107         checkOutput("pkg1/class-use/UsedInterface.html", true,
   107             "../C10.html#withTypeParametersOfType-java.lang.Class-"
   108             "../C10.html#withTypeParametersOfType(java.lang.Class)"
   108         );
   109         );
   109         checkOutput("pkg1/class-use/UsedInterface.html", true,
   110         checkOutput("pkg1/class-use/UsedInterface.html", true,
   110             "\"../package-summary.html\">pkg1</a> that return " +
   111             "\"../package-summary.html\">pkg1</a> that return " +
   111             "<a href=\"../UsedInterface.html\" title=\"interface in pkg1\""
   112             "<a href=\"../UsedInterface.html\" title=\"interface in pkg1\""
   112         );
   113         );
   113         checkOutput("pkg1/class-use/UsedInterface.html", true,
   114         checkOutput("pkg1/class-use/UsedInterface.html", true,
   114             "<a href=\"../C10.html#addAll-pkg1.UsedInterface...-\">addAll</a>"
   115             "<a href=\"../C10.html#addAll(pkg1.UsedInterface...)\">addAll</a>"
   115         );
   116         );
   116         checkOutput("pkg1/class-use/UsedInterface.html", true,
   117         checkOutput("pkg1/class-use/UsedInterface.html", true,
   117             "<a href=\"../C10.html#create-pkg1.UsedInterfaceA-pkg1." +
   118             "<a href=\"../C10.html#create(pkg1.UsedInterfaceA,pkg1." +
   118             "UsedInterface-java.lang.String-\">"
   119             "UsedInterface,java.lang.String)\">"
   119         );
   120         );
   120         checkOutput("pkg1/class-use/UsedInterface.html", true,
   121         checkOutput("pkg1/class-use/UsedInterface.html", true,
   121             "<a href=\"../C10.html#withTypeParametersOfType-java.lang.Class-\">" +
   122             "<a href=\"../C10.html#withTypeParametersOfType(java.lang.Class)\">" +
   122             "withTypeParametersOfType</a>"
   123             "withTypeParametersOfType</a>"
   123         );
   124         );
   124         checkOutput("pkg1/class-use/UsedInterface.html", true,
   125         checkOutput("pkg1/class-use/UsedInterface.html", true,
   125             "Subinterfaces of <a href=\"../UsedInterface.html\" title=\"interface in pkg1\">"
   126             "Subinterfaces of <a href=\"../UsedInterface.html\" title=\"interface in pkg1\">"
   126             + "UsedInterface</a> in <a href=\"../package-summary.html\">pkg1",
   127             + "UsedInterface</a> in <a href=\"../package-summary.html\">pkg1",
   127             "<td class=\"colFirst\"><code>interface&nbsp;</code></td>\n<th class=\"colSecond\" scope=\"row\">"
   128             "<td class=\"colFirst\"><code>interface&nbsp;</code></td>\n<th class=\"colSecond\" scope=\"row\">"
   128             + "<code><span class=\"memberNameLink\"><a href=\"../SubInterface.html\" "
   129             + "<code><span class=\"memberNameLink\"><a href=\"../SubInterface.html\" "
   129             + "title=\"interface in pkg1\">SubInterface</a>&lt;T&gt;</span></code></th>"
   130             + "title=\"interface in pkg1\">SubInterface</a>&lt;T&gt;</span></code></th>"
       
   131         );
       
   132         checkOutput("pkg1/class-use/UsedThrowable.html", true,
       
   133             "Methods in <a href=\"../package-summary.html\">pkg1</a> that throw "
       
   134             + "<a href=\"../UsedThrowable.html\" title=\"class in pkg1\">UsedThrowable</a>",
       
   135             "<td class=\"colFirst\"><code>void</code></td>\n<th class=\"colSecond\" scope=\"row\"><span class="
       
   136             + "\"typeNameLabel\">C1.</span><code><span class=\"memberNameLink\">"
       
   137             + "<a href=\"../C1.html#methodInC1ThrowsThrowable()\">methodInC1ThrowsThrowable"
       
   138             + "</a></span>()</code></th>"
       
   139         );
       
   140     }
       
   141 
       
   142     @Test
       
   143     void test1_html4() {
       
   144         javadoc("-d", "out-1-html4",
       
   145                 "-html4",
       
   146                 "-sourcepath", testSrc,
       
   147                 "-use",
       
   148                 "pkg1", "pkg2");
       
   149         checkExit(Exit.OK);
       
   150 
       
   151         checkOutput("pkg1/class-use/UsedClass.html", true,
       
   152           "<a href=\"../C1.html#methodInC1ReturningType--\">methodInC1ReturningType</a>"
       
   153         );
       
   154         checkOutput("pkg1/class-use/UsedInterface.html", true,
       
   155             "../C10.html#withReturningTypeParameters--"
       
   156         );
       
   157         checkOutput("pkg1/class-use/UsedInterface.html", true,
       
   158             "../C10.html#withTypeParametersOfType-java.lang.Class-"
       
   159         );
       
   160         checkOutput("pkg1/class-use/UsedInterface.html", true,
       
   161             "<a href=\"../C10.html#addAll-pkg1.UsedInterface...-\">addAll</a>"
       
   162         );
       
   163         checkOutput("pkg1/class-use/UsedInterface.html", true,
       
   164             "<a href=\"../C10.html#create-pkg1.UsedInterfaceA-pkg1." +
       
   165             "UsedInterface-java.lang.String-\">"
       
   166         );
       
   167         checkOutput("pkg1/class-use/UsedInterface.html", true,
       
   168             "<a href=\"../C10.html#withTypeParametersOfType-java.lang.Class-\">" +
       
   169             "withTypeParametersOfType</a>"
   130         );
   170         );
   131         checkOutput("pkg1/class-use/UsedThrowable.html", true,
   171         checkOutput("pkg1/class-use/UsedThrowable.html", true,
   132             "Methods in <a href=\"../package-summary.html\">pkg1</a> that throw "
   172             "Methods in <a href=\"../package-summary.html\">pkg1</a> that throw "
   133             + "<a href=\"../UsedThrowable.html\" title=\"class in pkg1\">UsedThrowable</a>",
   173             + "<a href=\"../UsedThrowable.html\" title=\"class in pkg1\">UsedThrowable</a>",
   134             "<td class=\"colFirst\"><code>void</code></td>\n<th class=\"colSecond\" scope=\"row\"><span class="
   174             "<td class=\"colFirst\"><code>void</code></td>\n<th class=\"colSecond\" scope=\"row\"><span class="
   149         checkOutput("class-use/UsedInC.html", true,
   189         checkOutput("class-use/UsedInC.html", true,
   150                 "Uses of <a href=\"../UsedInC.html\" title=\"class in &lt;Unnamed&gt;\">"
   190                 "Uses of <a href=\"../UsedInC.html\" title=\"class in &lt;Unnamed&gt;\">"
   151                 + "UsedInC</a> in <a href=\"../package-summary.html\">&lt;Unnamed&gt;</a>"
   191                 + "UsedInC</a> in <a href=\"../package-summary.html\">&lt;Unnamed&gt;</a>"
   152         );
   192         );
   153         checkOutput("class-use/UsedInC.html", true,
   193         checkOutput("class-use/UsedInC.html", true,
   154                 "<li class=\"blockList\"><a name=\"unnamed.package\">"
   194                 "<li class=\"blockList\">\n"
       
   195                 + "<section role=\"region\"><a id=\"unnamed.package\">"
   155         );
   196         );
   156         checkOutput("package-use.html", true,
   197         checkOutput("package-use.html", true,
   157                 "<th class=\"colFirst\" scope=\"row\">"
   198                 "<th class=\"colFirst\" scope=\"row\">"
   158                 + "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a></th>",
   199                 + "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a></th>",
       
   200                 "<th class=\"colFirst\" scope=\"row\"><a href=\"#%3CUnnamed%3E\">&lt;Unnamed&gt;</a></th>\n"
       
   201                 + "<td class=\"colLast\">&nbsp;</td>"
       
   202         );
       
   203     }
       
   204 
       
   205     @Test
       
   206     void test2_html4() {
       
   207         javadoc("-d", "out-2-html4",
       
   208                 "-html4",
       
   209                 "-sourcepath", testSrc,
       
   210                 "-use",
       
   211                 testSrc("C.java"), testSrc("UsedInC.java"), "pkg3");
       
   212         checkExit(Exit.OK);
       
   213 
       
   214         checkOutput("class-use/UsedInC.html", true,
       
   215                 "<li class=\"blockList\"><a name=\"unnamed.package\">"
       
   216         );
       
   217         checkOutput("package-use.html", true,
   159                 "<th class=\"colFirst\" scope=\"row\"><a href=\"#-Unnamed-\">&lt;Unnamed&gt;</a></th>\n"
   218                 "<th class=\"colFirst\" scope=\"row\"><a href=\"#-Unnamed-\">&lt;Unnamed&gt;</a></th>\n"
   160                 + "<td class=\"colLast\">&nbsp;</td>"
   219                 + "<td class=\"colLast\">&nbsp;</td>"
   161         );
   220         );
   162     }
   221     }
   163 
   222 
   164     @Test
   223     @Test
   165     void test3() {
   224     void test3() {
   166         javadoc("-d", "out-3",
   225         javadoc("-d", "out-3",
       
   226                 "-sourcepath", testSrc,
       
   227                 "-use",
       
   228                 "-package", "unique");
       
   229         checkExit(Exit.OK);
       
   230         checkUnique("unique/class-use/UseMe.html",
       
   231                 "<a href=\"../C1.html#umethod1(unique.UseMe,unique.UseMe%5B%5D)\">",
       
   232                 "<a href=\"../C1.html#umethod2(unique.UseMe,unique.UseMe)\">",
       
   233                 "<a href=\"../C1.html#umethod3(unique.UseMe,unique.UseMe)\">",
       
   234                 "<a href=\"../C1.html#%3Cinit%3E(unique.UseMe,unique.UseMe)\">");
       
   235     }
       
   236 
       
   237     @Test
       
   238     void test3_html4() {
       
   239         javadoc("-d", "out-3-html4",
       
   240                 "-html4",
   167                 "-sourcepath", testSrc,
   241                 "-sourcepath", testSrc,
   168                 "-use",
   242                 "-use",
   169                 "-package", "unique");
   243                 "-package", "unique");
   170         checkExit(Exit.OK);
   244         checkExit(Exit.OK);
   171         checkUnique("unique/class-use/UseMe.html",
   245         checkUnique("unique/class-use/UseMe.html",