1 /*
   2  * Copyright (c) 2004, 2018, 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      4632553 4973607 8026567
  27  * @summary  No need to include type name (class, interface, etc.) before
  28  *           every single type in class tree.
  29  *           Make sure class tree includes heirarchy for enums and annotation
  30  *           types.
  31  * @author   jamieh
  32  * @library  ../lib
  33  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  34  * @build    JavadocTester
  35  * @run main TestClassTree
  36  */
  37 
  38 public class TestClassTree extends JavadocTester {
  39 
  40     public static void main(String... args) throws Exception {
  41         TestClassTree tester = new TestClassTree();
  42         tester.runTests();
  43     }
  44 
  45     @Test
  46     void test() {
  47         javadoc("-d", "out",
  48                 "-sourcepath", testSrc,
  49                 "pkg");
  50         checkExit(Exit.OK);
  51 
  52         checkOutput("pkg/package-tree.html", true,
  53                 "<ul>\n"
  54                 + "<li class=\"circle\">pkg.<a href=\"ParentClass.html\" "
  55                 + "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>",
  56                 "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n"
  57                 + "<ul>\n"
  58                 + "<li class=\"circle\">pkg.<a href=\"AnnotationType.html\" "
  59                 + "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> "
  60                 + "(implements java.lang.annotation.Annotation)</li>\n"
  61                 + "</ul>",
  62                 "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n"
  63                 + "<ul>\n"
  64                 + "<li class=\"circle\">java.lang.Object\n"
  65                 + "<ul>\n"
  66                 + "<li class=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang."
  67                 + "Comparable&lt;T&gt;, java.io.Serializable)\n"
  68                 + "<ul>\n"
  69                 + "<li class=\"circle\">pkg.<a href=\"Coin.html\" "
  70                 + "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n"
  71                 + "</ul>\n"
  72                 + "</li>\n"
  73                 + "</ul>\n"
  74                 + "</li>\n"
  75                 + "</ul>");
  76 
  77         checkOutput("pkg/package-tree.html", false,
  78                 "<li class=\"circle\">class pkg.<a href=\".ParentClass.html\" "
  79                 + "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>");
  80     }
  81 }