TestSinceTag.java revision 2146:130b8c0e570e
1/*
2 * Copyright (c) 2012, 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      7180906 8026567
27 * @summary  Test to make sure that the since tag works correctly
28 * @author   Bhavesh Patel
29 * @library  ../lib/
30 * @build    JavadocTester TestSinceTag
31 * @run main TestSinceTag
32 */
33
34public class TestSinceTag extends JavadocTester {
35
36    //Test information.
37    private static final String BUG_ID = "7180906";
38
39    //Javadoc arguments.
40    private static final String[] ARGS1 = new String[] {
41        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"
42    };
43
44    private static final String[] ARGS2 = new String[] {
45        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-nosince", "pkg1"
46    };
47
48    //Input for string search tests.
49    private static final String[][] TEST = {
50        {BUG_ID + FS + "pkg1" + FS + "C1.html",
51            "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
52            "<dd>JDK1.0</dd>"
53        },
54        {BUG_ID + FS + "serialized-form.html",
55            "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
56            "<dd>1.4</dd>"
57        }
58    };
59
60    /**
61     * The entry point of the test.
62     * @param args the array of command line arguments.
63     */
64    public static void main(String[] args) {
65        TestSinceTag tester = new TestSinceTag();
66        run(tester, ARGS1, TEST, NO_TEST);
67        run(tester, ARGS2, NO_TEST, TEST);
68        tester.printSummary();
69    }
70
71    /**
72     * {@inheritDoc}
73     */
74    public String getBugId() {
75        return BUG_ID;
76    }
77
78    /**
79     * {@inheritDoc}
80     */
81    public String getBugName() {
82        return getClass().getName();
83    }
84}
85