1 /*
   2  * Copyright (c) 2016, 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 8073100 8182765 8196202
  27  * @summary ensure the hidden tag works as intended
  28  * @library ../../lib
  29  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  30  * @build javadoc.tester.*
  31  * @run main TestHiddenTag
  32  */
  33 
  34 import javadoc.tester.JavadocTester;
  35 
  36 public class TestHiddenTag extends JavadocTester {
  37 
  38     public static void main(String... args) throws Exception {
  39         TestHiddenTag tester = new TestHiddenTag();
  40         tester.runTests();
  41     }
  42 
  43     /**
  44      * Perform tests on @hidden tags
  45      */
  46     @Test
  47     public void test1() {
  48         javadoc("-d", "out1",
  49                 "-sourcepath", testSrc,
  50                 "-package",
  51                 "pkg1");
  52         checkExit(Exit.OK);
  53 
  54         checkOutput("pkg1/A.html", true,
  55                 "<section class=\"detail\" id=\"visibleField\">",
  56                 "<section class=\"detail\" id=\"visibleMethod()\">",
  57                 "<dt>Direct Known Subclasses:</dt>\n" +
  58                 "<dd><code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" +
  59                 "A.VisibleInner</a></code>, <code><a href=\"A.VisibleInnerExtendsInvisibleInner.html\" " +
  60                 "title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></dd>");
  61 
  62         checkOutput("pkg1/A.html", false,
  63                 "<h3 id=\"inVisibleField\">",
  64                 "<h3><span id=\"inVisibleMethod()\">");
  65 
  66         checkOutput("pkg1/A.VisibleInner.html", true,
  67                 "<code><a href=\"A.html#visibleField\">visibleField</a></code>",
  68                 "<code><a href=\"A.html#visibleMethod()\">visibleMethod</a></code>",
  69                 "<h2 id=\"nested.classes.inherited.from.class.pkg1.A\">" +
  70                 "Nested classes/interfaces inherited from class&nbsp;pkg1." +
  71                 "<a href=\"A.html\" title=\"class in pkg1\">A</a></h2>\n" +
  72                 "<code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" +
  73                 "A.VisibleInner</a>, <a href=\"A.VisibleInnerExtendsInvisibleInner.html\" " +
  74                 "title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></div>\n");
  75 
  76         checkOutput("pkg1/A.VisibleInner.html", false,
  77                 "../pkg1/A.VisibleInner.html#VisibleInner()",
  78                 "<a id=\"inVisibleField\">",
  79                 "<a id=\"inVisibleMethod()\">");
  80 
  81         checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", true,
  82                 "<pre>public static class <span class=\"typeNameLabel\">" +
  83                 "A.VisibleInnerExtendsInvisibleInner</span>\n" +
  84                 "extends <a href=\"A.html\" title=\"class in pkg1\">A</a></pre>",
  85                 "<code><a href=\"A.html#visibleField\">visibleField</a></code>",
  86                 "<code><a href=\"A.html#visibleMethod()\">visibleMethod</a></code>");
  87 
  88         checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", false,
  89                 "invisibleField",
  90                 "invisibleMethod",
  91                 "A.InvisibleInner");
  92 
  93         checkOutput("pkg1/package-summary.html", false, "A.InvisibleInner");
  94 
  95         checkOutput("pkg1/package-tree.html", false, "A.InvisibleInner");
  96 
  97         checkFiles(false,
  98                 "pkg1/A.InvisibleInner.html",
  99                 "pkg1/A.InvisibleInnerExtendsVisibleInner.html");
 100     }
 101 }