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

Wed, 18 Feb 2009 13:47:27 -0800

author
bpatel
date
Wed, 18 Feb 2009 13:47:27 -0800
changeset 222
d424ed561993
child 233
5240b1120530
permissions
-rw-r--r--

6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
Reviewed-by: jjg

     1 /*
     2  * Copyright 2009 Sun Microsystems, Inc.  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.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    26 /*
    27  * @test
    28  * @bug 6802694
    29  * @summary This test verifies deprecation info in serialized-form.html.
    30  * @author Bhavesh Patel
    31  * @library ../lib/
    32  * @build JavadocTester
    33  * @build TestSerializedFormDeprecationInfo
    34  * @run main TestSerializedFormDeprecationInfo
    35  */
    37 public class TestSerializedFormDeprecationInfo extends JavadocTester {
    39     private static final String BUG_ID = "6802694";
    41     // Test for normal run of javadoc. The serialized-form.html should
    42     // display the inline comments, tags and deprecation information if any.
    43     private static final String[][] TEST_CMNT_DEPR = {
    44         {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL + NL +
    45                  "<DT><STRONG>Throws:</STRONG>" + NL + "<DD><CODE>" +
    46                  "java.io.IOException</CODE><DT><STRONG>See Also:</STRONG>" +
    47                  "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    48                  "<CODE>C1.setUndecorated(boolean)</CODE></A></DD>" + NL +
    49                  "</DL>" + NL + "</DL>"},
    50         {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
    51                  "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
    52                  " 1.5, replaced by" + NL +
    53                  " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    54                  "<CODE>setUndecorated(boolean)</CODE></A>.</I>" +
    55                  "<DD>This field indicates whether the C1 is undecorated." + NL +
    56                  "<P>" + NL + "<DT><DD>&nbsp;<DL>" + NL +
    57                  "<DT><STRONG>Since:</STRONG></DT>" + NL +
    58                  "  <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
    59                  "<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    60                  "<CODE>C1.setUndecorated(boolean)</CODE></A></DL>" + NL +
    61                  "</DL>"},
    62         {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
    63                  "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
    64                  " 1.5, replaced by" + NL +
    65                  " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    66                  "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
    67                  "<DD>Reads the object stream." + NL + "<P>" + NL +
    68                  "<DD><DL>" + NL + NL + "<DT><STRONG>Throws:" +
    69                  "</STRONG>" + NL + "<DD><CODE><code>" +
    70                  "IOException</code></CODE>" + NL +
    71                  "<DD><CODE>java.io.IOException</CODE></DD>" + NL +
    72                  "</DL>" + NL + "</DL>"},
    73         {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
    74                  "<DD><STRONG>Deprecated.</STRONG>&nbsp;<DD>" +
    75                  "The name for this class." + NL + "<P>" + NL +
    76                  "<DT><DD>&nbsp;<DL>" + NL + "</DL>" + NL + "</DL>"}};
    78     // Test with -nocomment option. The serialized-form.html should
    79     // not display the inline comments and tags but should display deprecation
    80     // information if any.
    81     private static final String[][] TEST_NOCMNT = {
    82         {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" +
    83                  "undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
    84                  "Deprecated.</STRONG>&nbsp;<I>As of JDK version 1.5, replaced by" + NL +
    85                  " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
    86                  "setUndecorated(boolean)</CODE></A>.</I></DL>"},
    87         {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
    88                  "Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
    89                  " 1.5, replaced by" + NL +
    90                  " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    91                  "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
    92                  "</DL>"},
    93         {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
    94                  "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
    95                  "Deprecated.</STRONG>&nbsp;</DL>"}};
    97     // Test with -nodeprecated option. The serialized-form.html should
    98     // ignore the -nodeprecated tag and display the deprecation info. This
    99     // test is similar to the normal run of javadoc in which inline comment, tags
   100     // and deprecation information will be displayed.
   101     private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
   103     // Test with -nodeprecated and -nocomment options. The serialized-form.html should
   104     // ignore the -nodeprecated tag and display the deprecation info but should not
   105     // display the inline comments and tags. This test is similar to the test with
   106     // -nocomment option.
   107     private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
   109     private static final String[] ARGS1 =
   110         new String[] {
   111             "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
   113     private static final String[] ARGS2 =
   114         new String[] {
   115             "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
   117     private static final String[] ARGS3 =
   118         new String[] {
   119             "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
   121     private static final String[] ARGS4 =
   122         new String[] {
   123             "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
   125     /**
   126      * The entry point of the test.
   127      * @param args the array of command line arguments.
   128      */
   129     public static void main(String[] args) {
   130         TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
   131         run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
   132         run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
   133         run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
   134         run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
   135         tester.printSummary();
   136     }
   138     /**
   139      * {@inheritDoc}
   140      */
   141     public String getBugId() {
   142         return BUG_ID;
   143     }
   145     /**
   146      * {@inheritDoc}
   147      */
   148     public String getBugName() {
   149         return getClass().getName();
   150     }
   151 }

mercurial