test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java

changeset 1
9a66ca7c79fa
child 182
47a62d8d98b4
equal deleted inserted replaced
-1:000000000000 1:9a66ca7c79fa
1 /*
2 * Copyright 2002-2005 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 */
23
24 /*
25 * @test
26 * @bug 4638588 4635809 6256068 6270645
27 * @summary Test to make sure that members are inherited properly in the Javadoc.
28 * Verify that inheritence labels are correct.
29 * @author jamieh
30 * @library ../lib/
31 * @build JavadocTester
32 * @build TestMemberInheritence
33 * @run main TestMemberInheritence
34 */
35
36 public class TestMemberInheritence extends JavadocTester {
37
38 private static final String BUG_ID = "4638588-4635809-6256068-6270645";
39
40 private static final String[][] TEST = {
41 //Public field should be inherited
42 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
43 "<A HREF=\"../pkg/BaseClass.html#pubField\">"},
44
45 //Public method should be inherited
46 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
47 "<A HREF=\"../pkg/BaseClass.html#pubMethod()\">"},
48
49 //Public inner class should be inherited.
50 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
51 "<A HREF=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">"},
52
53 //Protected field should be inherited
54 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
55 "<A HREF=\"../pkg/BaseClass.html#proField\">"},
56
57 //Protected method should be inherited
58 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
59 "<A HREF=\"../pkg/BaseClass.html#proMethod()\">"},
60
61 //Protected inner class should be inherited.
62 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
63 "<A HREF=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">"},
64
65 // New labels as of 1.5.0
66 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
67 "<B>Nested classes/interfaces inherited from class pkg." +
68 "<A HREF=\"../pkg/BaseClass.html\" title=\"class in pkg\">" +
69 "BaseClass</A></B>"},
70 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
71 "<B>Nested classes/interfaces inherited from interface pkg." +
72 "<A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
73 "BaseInterface</A></B>"},
74
75 // Test overriding/implementing methods with generic parameters.
76 {BUG_ID + FS + "pkg" + FS + "BaseClass.html",
77 "<DT><B>Specified by:</B><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DL>"},
78
79 // Test diamond inheritence member summary (6256068)
80 {BUG_ID + FS + "diamond" + FS + "Z.html",
81 "<TD><CODE><A HREF=\"../diamond/A.html#aMethod()\">aMethod</A></CODE></TD>"},
82
83 // Test that doc is inherited from closed parent (6270645)
84 {BUG_ID + FS + "inheritDist" + FS + "C.html",
85 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m1-B</TD>"},
86
87 };
88
89 private static final String[][] NEGATED_TEST = {
90 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
91 "<A HREF=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</A></CODE>"},
92 };
93 private static final String[] ARGS =
94 new String[] {
95 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "diamond", "inheritDist"};
96
97 /**
98 * The entry point of the test.
99 * @param args the array of command line arguments.
100 */
101 public static void main(String[] args) {
102 TestMemberInheritence tester = new TestMemberInheritence();
103 run(tester, ARGS, TEST, NEGATED_TEST);
104 tester.printSummary();
105 }
106
107 /**
108 * {@inheritDoc}
109 */
110 public String getBugId() {
111 return BUG_ID;
112 }
113
114 /**
115 * {@inheritDoc}
116 */
117 public String getBugName() {
118 return getClass().getName();
119 }
120 }

mercurial