|
1 /* |
|
2 * Copyright (c) 2004, 2013, 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 4515705 4804296 4702454 4697036 8025633 |
|
27 * @summary Make sure that first sentence warning only appears once. |
|
28 * Make sure that only warnings/errors are printed when quiet is used. |
|
29 * Make sure that links to private/unincluded methods do not cause |
|
30 * a "link unresolved" warning. |
|
31 * Make sure error message starts with "error -". |
|
32 * @author jamieh |
|
33 * @library ../lib/ |
|
34 * @build JavadocTester |
|
35 * @build TestWarnings |
|
36 * @run main TestWarnings |
|
37 */ |
|
38 |
|
39 public class TestWarnings extends JavadocTester { |
|
40 |
|
41 //Test information. |
|
42 private static final String BUG_ID = "4515705-4804296-4702454-4697036"; |
|
43 |
|
44 //Javadoc arguments. |
|
45 private static final String[] ARGS = new String[] { |
|
46 "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg" |
|
47 }; |
|
48 |
|
49 private static final String[] ARGS2 = new String[] { |
|
50 "-Xdoclint:none", "-d", BUG_ID, "-private", "-sourcepath", SRC_DIR, "pkg" |
|
51 }; |
|
52 |
|
53 //Input for string search tests. |
|
54 private static final String[][] TEST = { |
|
55 {WARNING_OUTPUT, |
|
56 "X.java:11: warning - Missing closing '}' character for inline tag"}, |
|
57 {ERROR_OUTPUT, |
|
58 "package.html: error - Body tag missing from HTML"}, |
|
59 |
|
60 }; |
|
61 private static final String[][] NEGATED_TEST = { |
|
62 {BUG_ID + FS + "pkg" + FS + "X.html", "can't find m()"}, |
|
63 {BUG_ID + FS + "pkg" + FS + "X.html", "can't find X()"}, |
|
64 {BUG_ID + FS + "pkg" + FS + "X.html", "can't find f"}, |
|
65 }; |
|
66 |
|
67 private static final String[][] TEST2 = { |
|
68 {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"}, |
|
69 {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"}, |
|
70 {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"}, |
|
71 }; |
|
72 |
|
73 private static final String[][] NEGATED_TEST2 = NO_TEST; |
|
74 |
|
75 |
|
76 /** |
|
77 * The entry point of the test. |
|
78 * @param args the array of command line arguments. |
|
79 */ |
|
80 public static void main(String[] args) { |
|
81 TestWarnings tester = new TestWarnings(); |
|
82 run(tester, ARGS, TEST, NEGATED_TEST); |
|
83 run(tester, ARGS2, TEST2, NEGATED_TEST2); |
|
84 tester.printSummary(); |
|
85 } |
|
86 |
|
87 /** |
|
88 * {@inheritDoc} |
|
89 */ |
|
90 public String getBugId() { |
|
91 return BUG_ID; |
|
92 } |
|
93 |
|
94 /** |
|
95 * {@inheritDoc} |
|
96 */ |
|
97 public String getBugName() { |
|
98 return getClass().getName(); |
|
99 } |
|
100 } |