test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java

Mon, 02 May 2011 02:13:02 -0700

author
bpatel
date
Mon, 02 May 2011 02:13:02 -0700
changeset 995
62bc3775d5bb
child 1935
8c55df2442c1
permissions
-rw-r--r--

6492694: @deprecated tag doesn't work in package-info files.
Reviewed-by: jjg

bpatel@995 1 /*
bpatel@995 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
bpatel@995 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@995 4 *
bpatel@995 5 * This code is free software; you can redistribute it and/or modify it
bpatel@995 6 * under the terms of the GNU General Public License version 2 only, as
bpatel@995 7 * published by the Free Software Foundation.
bpatel@995 8 *
bpatel@995 9 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@995 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@995 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@995 12 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@995 13 * accompanied this code).
bpatel@995 14 *
bpatel@995 15 * You should have received a copy of the GNU General Public License version
bpatel@995 16 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@995 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@995 18 *
bpatel@995 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bpatel@995 20 * or visit www.oracle.com if you need additional information or have any
bpatel@995 21 * questions.
bpatel@995 22 */
bpatel@995 23
bpatel@995 24 /*
bpatel@995 25 * @test
bpatel@995 26 * @bug 6492694
bpatel@995 27 * @summary Test package deprecation.
bpatel@995 28 * @author bpatel
bpatel@995 29 * @library ../lib/
bpatel@995 30 * @build JavadocTester TestPackageDeprecation
bpatel@995 31 * @run main TestPackageDeprecation
bpatel@995 32 */
bpatel@995 33
bpatel@995 34 public class TestPackageDeprecation extends JavadocTester {
bpatel@995 35
bpatel@995 36 //Test information.
bpatel@995 37 private static final String BUG_ID = "6492694";
bpatel@995 38
bpatel@995 39 //Javadoc arguments.
bpatel@995 40 private static final String[] ARGS1 = new String[]{
bpatel@995 41 "-d", BUG_ID + "-1", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1",
bpatel@995 42 SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java"
bpatel@995 43 };
bpatel@995 44 private static final String[] ARGS2 = new String[]{
bpatel@995 45 "-d", BUG_ID + "-2", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "-nodeprecated",
bpatel@995 46 "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java"
bpatel@995 47 };
bpatel@995 48
bpatel@995 49 //Input for string search tests.
bpatel@995 50 private static final String[][] TEST1 = {
bpatel@995 51 {BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html",
bpatel@995 52 "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>" + NL +
bpatel@995 53 "<div class=\"block\"><i>This package is Deprecated.</i></div>"
bpatel@995 54 },
bpatel@995 55 {BUG_ID + "-1" + FS + "deprecated-list.html",
bpatel@995 56 "<li><a href=\"#package\">Deprecated Packages</a></li>"
bpatel@995 57 }
bpatel@995 58 };
bpatel@995 59 private static final String[][] TEST2 = NO_TEST;
bpatel@995 60 private static final String[][] NEGATED_TEST1 = NO_TEST;
bpatel@995 61 private static final String[][] NEGATED_TEST2 = {
bpatel@995 62 {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"},
bpatel@995 63 {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"}
bpatel@995 64 };
bpatel@995 65
bpatel@995 66 /**
bpatel@995 67 * The entry point of the test.
bpatel@995 68 * @param args the array of command line arguments.
bpatel@995 69 */
bpatel@995 70 public static void main(String[] args) {
bpatel@995 71 TestPackageDeprecation tester = new TestPackageDeprecation();
bpatel@995 72 run(tester, ARGS1, TEST1, NEGATED_TEST1);
bpatel@995 73 run(tester, ARGS2, TEST2, NEGATED_TEST2);
bpatel@995 74 if ((new java.io.File(BUG_ID + "-2" + FS + "pkg1" + FS +
bpatel@995 75 "package-summary.html")).exists()) {
bpatel@995 76 throw new Error("Test Fails: packages summary should not be" +
bpatel@995 77 "generated for deprecated package.");
bpatel@995 78 } else {
bpatel@995 79 System.out.println("Test passes: package-summary.html not found.");
bpatel@995 80 }
bpatel@995 81 if ((new java.io.File(BUG_ID + "-2" + FS + "FooDepr.html")).exists()) {
bpatel@995 82 throw new Error("Test Fails: FooDepr should not be" +
bpatel@995 83 "generated as it is deprecated.");
bpatel@995 84 } else {
bpatel@995 85 System.out.println("Test passes: FooDepr.html not found.");
bpatel@995 86 }
bpatel@995 87 tester.printSummary();
bpatel@995 88 }
bpatel@995 89
bpatel@995 90 /**
bpatel@995 91 * {@inheritDoc}
bpatel@995 92 */
bpatel@995 93 public String getBugId() {
bpatel@995 94 return BUG_ID;
bpatel@995 95 }
bpatel@995 96
bpatel@995 97 /**
bpatel@995 98 * {@inheritDoc}
bpatel@995 99 */
bpatel@995 100 public String getBugName() {
bpatel@995 101 return getClass().getName();
bpatel@995 102 }
bpatel@995 103 }

mercurial