1 /*
   2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8025524 8031625 8081854 8175200 8186332 8182765
  27  * @summary Test for constructor name which should be a non-qualified name.
  28  * @library ../../lib
  29  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  30  * @build javadoc.tester.*
  31  * @run main TestConstructors
  32  */
  33 
  34 import javadoc.tester.JavadocTester;
  35 
  36 public class TestConstructors extends JavadocTester {
  37 
  38     public static void main(String... args) throws Exception {
  39         TestConstructors tester = new TestConstructors();
  40         tester.runTests();
  41     }
  42 
  43     @Test
  44     public void test() {
  45         javadoc("-d", "out",
  46                 "-sourcepath", testSrc,
  47                 "pkg1");
  48         checkExit(Exit.OK);
  49 
  50         checkOutput("pkg1/Outer.html", true,
  51                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
  52                 + "<dd><a href=\"Outer.Inner.html#%3Cinit%3E()\"><code>Inner()</code></a>, \n"
  53                 + "<a href=\"Outer.Inner.html#%3Cinit%3E(int)\"><code>Inner(int)</code></a>, \n"
  54                 + "<a href=\"Outer.Inner.NestedInner.html#%3Cinit%3E()\"><code>NestedInner()</code></a>, \n"
  55                 + "<a href=\"Outer.Inner.NestedInner.html#%3Cinit%3E(int)\"><code>NestedInner(int)</code></a>, \n"
  56                 + "<a href=\"#%3Cinit%3E()\"><code>Outer()</code></a>, \n"
  57                 + "<a href=\"#%3Cinit%3E(int)\"><code>Outer(int)</code></a></dd>",
  58                 "Link: <a href=\"Outer.Inner.html#%3Cinit%3E()\"><code>Inner()</code></a>, "
  59                 + "<a href=\"#%3Cinit%3E(int)\"><code>Outer(int)</code></a>, "
  60                 + "<a href=\"Outer.Inner.NestedInner.html#%3Cinit%3E(int)\"><code>NestedInner(int)</code></a>",
  61                 "<a href=\"#%3Cinit%3E()\">Outer</a></span>()",
  62                 "<section class=\"detail\" id=\"&lt;init&gt;()\">",
  63                 "<a href=\"#%3Cinit%3E(int)\">Outer</a></span>​(int&nbsp;i)",
  64                 "<section class=\"detail\" id=\"&lt;init&gt;(int)\">");
  65 
  66         checkOutput("pkg1/Outer.Inner.html", true,
  67                 "<a href=\"#%3Cinit%3E()\">Inner</a></span>()",
  68                 "<section class=\"detail\" id=\"&lt;init&gt;()\">",
  69                 "<a href=\"#%3Cinit%3E(int)\">Inner</a></span>​(int&nbsp;i)",
  70                 "<section class=\"detail\" id=\"&lt;init&gt;(int)\">");
  71 
  72         checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
  73                 "<a href=\"#%3Cinit%3E()\">NestedInner</a></span>()",
  74                 "<section class=\"detail\" id=\"&lt;init&gt;()\">",
  75                 "<a href=\"#%3Cinit%3E(int)\">NestedInner</a></span>​(int&nbsp;i)",
  76                 "<section class=\"detail\" id=\"&lt;init&gt;(int)\">");
  77 
  78         checkOutput("pkg1/Outer.Inner.html", false,
  79                 "Outer.Inner()",
  80                 "Outer.Inner(int)");
  81 
  82         checkOutput("pkg1/Outer.Inner.NestedInner.html", false,
  83                 "Outer.Inner.NestedInner()",
  84                 "Outer.Inner.NestedInner(int)");
  85 
  86         checkOutput("pkg1/Outer.html", false,
  87                 "<a href=\"Outer.Inner.html#Outer.Inner()\"><code>Outer.Inner()</code></a>",
  88                 "<a href=\"Outer.Inner.html#Outer.Inner(int)\"><code>Outer.Inner(int)</code></a>",
  89                 "<a href=\"Outer.Inner.NestedInner.html#Outer.Inner.NestedInner()\"><code>Outer.Inner.NestedInner()</code></a>",
  90                 "<a href=\"Outer.Inner.NestedInner.html#Outer.Inner.NestedInner(int)\"><code>Outer.Inner.NestedInner(int)</code></a>");
  91     }
  92 }