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