TestAbstractMethod.java revision 3233:b5d08bc0d224
1/*
2 * Copyright (c) 2012, 2015, 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      8004891
27 * @summary  Make sure that the abstract method is identified correctly
28 *           if the abstract modifier is present explicitly or implicitly.
29 * @author   bpatel
30 * @library  ../lib
31 * @modules jdk.javadoc
32 * @build    JavadocTester
33 * @run main TestAbstractMethod
34 */
35
36public class TestAbstractMethod extends JavadocTester {
37
38    public static void main(String... args) throws Exception {
39        TestAbstractMethod tester = new TestAbstractMethod();
40        tester.runTests();
41    }
42
43    @Test
44    void test() {
45        javadoc("-d", "out",
46                "-sourcepath", testSrc,
47                "pkg");
48        checkExit(Exit.OK);
49
50        checkOutput("pkg/A.html", true,
51                "<td class=\"colFirst\"><code>default void</code></td>",
52                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
53                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
54                + "<span id=\"t2\" class=\"tableTab\"><span>"
55                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
56                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
57                + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
58                + "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>"
59                + "</span><span id=\"t5\" class=\"tableTab\"><span>"
60                + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
61                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>");
62
63        checkOutput("pkg/B.html", true,
64                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
65                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
66                + "<span id=\"t2\" class=\"tableTab\"><span>"
67                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
68                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
69                + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract "
70                + "Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
71                + "<span id=\"t4\" class=\"tableTab\"><span>"
72                + "<a href=\"javascript:show(8);\">Concrete Methods</a></span>"
73                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
74                "<td class=\"colFirst\"><code>abstract void</code></td>");
75
76        checkOutput("pkg/C.html", true,
77                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
78                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
79                + "<span id=\"t2\" class=\"tableTab\"><span>"
80                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
81                + "<span class=\"tabEnd\">&nbsp;</span></span>"
82                + "<span id=\"t5\" class=\"tableTab\"><span>"
83                + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
84                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
85                "<td class=\"colFirst\"><code>default void</code></td>");
86
87        checkOutput("pkg/A.html", false,
88                "<td class=\"colFirst\"><code>abstract void</code></td>");
89
90        checkOutput("pkg/B.html", false,
91                "<span><a href=\"javascript:show(16);\">Default Methods</a></span>"
92                + "<span class=\"tabEnd\">&nbsp;</span>",
93                "<td class=\"colFirst\"><code>default void</code></td>");
94
95        checkOutput("pkg/C.html", false,
96                "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>"
97                + "<span class=\"tabEnd\">&nbsp;</span>");
98    }
99}
100