test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java

changeset 222
d424ed561993
child 233
5240b1120530
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Wed Feb 18 13:47:27 2009 -0800
     1.3 @@ -0,0 +1,151 @@
     1.4 +/*
     1.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Sun designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Sun in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 + * have any questions.
    1.27 + */
    1.28 +
    1.29 +/*
    1.30 + * @test
    1.31 + * @bug 6802694
    1.32 + * @summary This test verifies deprecation info in serialized-form.html.
    1.33 + * @author Bhavesh Patel
    1.34 + * @library ../lib/
    1.35 + * @build JavadocTester
    1.36 + * @build TestSerializedFormDeprecationInfo
    1.37 + * @run main TestSerializedFormDeprecationInfo
    1.38 + */
    1.39 +
    1.40 +public class TestSerializedFormDeprecationInfo extends JavadocTester {
    1.41 +
    1.42 +    private static final String BUG_ID = "6802694";
    1.43 +
    1.44 +    // Test for normal run of javadoc. The serialized-form.html should
    1.45 +    // display the inline comments, tags and deprecation information if any.
    1.46 +    private static final String[][] TEST_CMNT_DEPR = {
    1.47 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL + NL +
    1.48 +                 "<DT><STRONG>Throws:</STRONG>" + NL + "<DD><CODE>" +
    1.49 +                 "java.io.IOException</CODE><DT><STRONG>See Also:</STRONG>" +
    1.50 +                 "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    1.51 +                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DD>" + NL +
    1.52 +                 "</DL>" + NL + "</DL>"},
    1.53 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
    1.54 +                 "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
    1.55 +                 " 1.5, replaced by" + NL +
    1.56 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    1.57 +                 "<CODE>setUndecorated(boolean)</CODE></A>.</I>" +
    1.58 +                 "<DD>This field indicates whether the C1 is undecorated." + NL +
    1.59 +                 "<P>" + NL + "<DT><DD>&nbsp;<DL>" + NL +
    1.60 +                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
    1.61 +                 "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
    1.62 +                 "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    1.63 +                 "<CODE>C1.setUndecorated(boolean)</CODE></A></DL>" + NL +
    1.64 +                 "</DL>"},
    1.65 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
    1.66 +                 "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
    1.67 +                 " 1.5, replaced by" + NL +
    1.68 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    1.69 +                 "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
    1.70 +                 "<DD>Reads the object stream." + NL + "<P>" + NL +
    1.71 +                 "<DD><DL>" + NL + NL + "<DT><STRONG>Throws:" +
    1.72 +                 "</STRONG>" + NL + "<DD><CODE><code>" +
    1.73 +                 "IOException</code></CODE>" + NL +
    1.74 +                 "<DD><CODE>java.io.IOException</CODE></DD>" + NL +
    1.75 +                 "</DL>" + NL + "</DL>"},
    1.76 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
    1.77 +                 "<DD><STRONG>Deprecated.</STRONG>&nbsp;<DD>" +
    1.78 +                 "The name for this class." + NL + "<P>" + NL +
    1.79 +                 "<DT><DD>&nbsp;<DL>" + NL + "</DL>" + NL + "</DL>"}};
    1.80 +
    1.81 +    // Test with -nocomment option. The serialized-form.html should
    1.82 +    // not display the inline comments and tags but should display deprecation
    1.83 +    // information if any.
    1.84 +    private static final String[][] TEST_NOCMNT = {
    1.85 +        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" +
    1.86 +                 "undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
    1.87 +                 "Deprecated.</STRONG>&nbsp;<I>As of JDK version 1.5, replaced by" + NL +
    1.88 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
    1.89 +                 "setUndecorated(boolean)</CODE></A>.</I></DL>"},
    1.90 +        {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
    1.91 +                 "Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
    1.92 +                 " 1.5, replaced by" + NL +
    1.93 +                 " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    1.94 +                 "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
    1.95 +                 "</DL>"},
    1.96 +        {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
    1.97 +                 "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
    1.98 +                 "Deprecated.</STRONG>&nbsp;</DL>"}};
    1.99 +
   1.100 +    // Test with -nodeprecated option. The serialized-form.html should
   1.101 +    // ignore the -nodeprecated tag and display the deprecation info. This
   1.102 +    // test is similar to the normal run of javadoc in which inline comment, tags
   1.103 +    // and deprecation information will be displayed.
   1.104 +    private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
   1.105 +
   1.106 +    // Test with -nodeprecated and -nocomment options. The serialized-form.html should
   1.107 +    // ignore the -nodeprecated tag and display the deprecation info but should not
   1.108 +    // display the inline comments and tags. This test is similar to the test with
   1.109 +    // -nocomment option.
   1.110 +    private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
   1.111 +
   1.112 +    private static final String[] ARGS1 =
   1.113 +        new String[] {
   1.114 +            "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
   1.115 +
   1.116 +    private static final String[] ARGS2 =
   1.117 +        new String[] {
   1.118 +            "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
   1.119 +
   1.120 +    private static final String[] ARGS3 =
   1.121 +        new String[] {
   1.122 +            "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
   1.123 +
   1.124 +    private static final String[] ARGS4 =
   1.125 +        new String[] {
   1.126 +            "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
   1.127 +
   1.128 +    /**
   1.129 +     * The entry point of the test.
   1.130 +     * @param args the array of command line arguments.
   1.131 +     */
   1.132 +    public static void main(String[] args) {
   1.133 +        TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
   1.134 +        run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
   1.135 +        run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
   1.136 +        run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
   1.137 +        run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
   1.138 +        tester.printSummary();
   1.139 +    }
   1.140 +
   1.141 +    /**
   1.142 +     * {@inheritDoc}
   1.143 +     */
   1.144 +    public String getBugId() {
   1.145 +        return BUG_ID;
   1.146 +    }
   1.147 +
   1.148 +    /**
   1.149 +     * {@inheritDoc}
   1.150 +     */
   1.151 +    public String getBugName() {
   1.152 +        return getClass().getName();
   1.153 +    }
   1.154 +}

mercurial