TestClassLinks.java revision 3593:70c752a3447a
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 8163800
27 * @summary The fix for JDK-8072052 shows up other minor incorrect use of styles
28 * @library ../lib
29 * @modules jdk.javadoc/jdk.javadoc.internal.tool
30 * @build JavadocTester
31 * @build TestClassLinks
32 * @run main TestClassLinks
33 */
34
35public class TestClassLinks extends JavadocTester {
36
37    public static void main(String... args) throws Exception {
38        TestClassLinks tester = new TestClassLinks();
39        tester.runTests();
40    }
41
42    @Test
43    void test() {
44
45        javadoc("-d", "out",
46                "-Xdoclint:none",
47                "-sourcepath", testSrc,
48                "-package",
49                "p");
50        checkExit(Exit.OK);
51
52        checkOutput("p/C1.html", true,
53                "<code><a href=\"../p/C2.html\" title=\"class in p\">C2</a></code>",
54                "<code><span class=\"memberNameLink\"><a href=\"../p/C1.html#C1--\">C1</a></span>()</code>");
55
56        checkOutput("p/C2.html", true,
57                "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
58                "<code><span class=\"memberNameLink\"><a href=\"../p/C2.html#C2--\">C2</a></span>()</code>");
59
60        checkOutput("p/C3.html", true,
61                "<code><a href=\"../p/I1.html\" title=\"interface in p\">I1</a></code>, "
62                + "<code><a href=\"../p/I12.html\" title=\"interface in p\">I12</a></code>, "
63                + "<code><a href=\"../p/I2.html\" title=\"interface in p\">I2</a></code>, "
64                + "<code><a href=\"../p/IT1.html\" title=\"interface in p\">IT1</a>&lt;T&gt;</code>, "
65                + "<code><a href=\"../p/IT2.html\" title=\"interface in p\">IT2</a>&lt;java.lang.String&gt;</code>",
66                "<code><span class=\"memberNameLink\"><a href=\"../p/C3.html#C3--\">C3</a></span>()</code>");
67
68        checkOutput("p/I1.html", true,
69                "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
70                "<code><a href=\"../p/I12.html\" title=\"interface in p\">I12</a></code>");
71
72        checkOutput("p/I2.html", true,
73                "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
74                "<code><a href=\"../p/I12.html\" title=\"interface in p\">I12</a></code>");
75
76        checkOutput("p/I12.html", true,
77                "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
78                "<code><a href=\"../p/I1.html\" title=\"interface in p\">I1</a></code>, <code><a href=\"../p/I2.html\" title=\"interface in p\">I2</a></code>");
79
80        checkOutput("p/IT1.html", true,
81                "<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>");
82
83        checkOutput("p/IT2.html", true,
84                "code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>");
85
86    }
87
88}
89