Wed, 08 Oct 2014 14:16:40 -0700
Merge
1 /*
2 * Copyright (c) 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 */
24 /*
25 * @test
26 * @bug 8006248
27 * @summary Test custom tag. Verify that an unknown tag generates appropriate warnings.
28 * @author Bhavesh Patel
29 * @library ../lib/
30 * @build JavadocTester taglets.CustomTag TestCustomTag
31 * @run main TestCustomTag
32 */
34 public class TestCustomTag extends JavadocTester {
36 //Test information.
37 private static final String BUG_ID = "8006248";
39 //Javadoc arguments.
40 private static final String[] ARGS = new String[] {
41 "-Xdoclint:none", "-d", BUG_ID, "-tagletpath", SRC_DIR,
42 "-taglet", "taglets.CustomTag", "-sourcepath",
43 SRC_DIR, SRC_DIR + FS + "TagTestClass.java"
44 };
46 private static final String[] ARGS1 = new String[] {
47 "-d", BUG_ID + "-1", "-tagletpath", SRC_DIR, "-taglet", "taglets.CustomTag",
48 "-sourcepath", SRC_DIR, SRC_DIR + FS + "TagTestClass.java"
49 };
50 private static final String[] ARGS2 = new String[] {
51 "-Xdoclint:none", "-d", BUG_ID + "-2", "-sourcepath",
52 SRC_DIR, SRC_DIR + FS + "TagTestClass.java"
53 };
55 private static final String[] ARGS3 = new String[] {
56 "-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, SRC_DIR + FS + "TagTestClass.java"
57 };
59 //Input for string search tests.
60 private static final String[][] TEST = new String[][] {
61 {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
62 }
63 };
65 private static final String[][] TEST1 = new String[][] {
66 {ERROR_OUTPUT, "error: unknown tag: unknownTag"
67 }
68 };
69 private static final String[][] TEST2 = new String[][] {
70 {WARNING_OUTPUT, "warning - @customTag is an unknown tag."
71 },
72 {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
73 }
74 };
76 private static final String[][] TEST3 = new String[][] {
77 {ERROR_OUTPUT, "error: unknown tag: customTag"
78 },
79 {ERROR_OUTPUT, "error: unknown tag: unknownTag"
80 }
81 };
83 /**
84 * The entry point of the test.
85 * @param args the array of command line arguments.
86 */
87 public static void main(String[] args) {
88 TestCustomTag tester = new TestCustomTag();
89 run(tester, ARGS, TEST, NO_TEST);
90 run(tester, ARGS1, TEST1, NO_TEST);
91 run(tester, ARGS2, TEST2, NO_TEST);
92 run(tester, ARGS3, TEST3, NO_TEST);
93 tester.printSummary();
94 }
96 /**
97 * {@inheritDoc}
98 */
99 public String getBugId() {
100 return BUG_ID;
101 }
103 /**
104 * {@inheritDoc}
105 */
106 public String getBugName() {
107 return getClass().getName();
108 }
109 }