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

Wed, 01 Dec 2010 11:02:38 -0800

author
bpatel
date
Wed, 01 Dec 2010 11:02:38 -0800
changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
permissions
-rw-r--r--

6851834: Javadoc doclet needs a structured approach to generate the output HTML.
Reviewed-by: jjg

     1 /*
     2  * Copyright (c) 2009, 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.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * 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>" +
    45                  "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
    46                  "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
    47                  "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    48                  "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
    49         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
    50                  "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
    51                  " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    52                  "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
    53                  "<div class=\"block\">This field indicates whether the C1 " +
    54                  "is undecorated.</div>" + NL + "&nbsp;" + NL +
    55                  "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
    56                  "  <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
    57                  "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    58                  "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
    59         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
    60                  "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
    61                  " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    62                  "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
    63                  "<div class=\"block\">Reads the object stream.</div>" + NL +
    64                  "<dl><dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
    65                  "IOException</code></code></dd>" + NL +
    66                  "<dd><code>java.io.IOException</code></dd></dl>"},
    67         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
    68                  "&nbsp;</div>" + NL + "<div class=\"block\">" +
    69                  "The name for this class.</div>"}};
    71     // Test with -nocomment option. The serialized-form.html should
    72     // not display the inline comments and tags but should display deprecation
    73     // information if any.
    74     private static final String[][] TEST_NOCMNT = {
    75         {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
    76                  "<div class=\"block\"><span class=\"strong\">Deprecated.</span>&nbsp;<i>" +
    77                  "As of JDK version 1.5, replaced by" + NL +
    78                  " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
    79                  "setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"},
    80         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
    81                  "Deprecated.</span>&nbsp;<i>As of JDK version" +
    82                  " 1.5, replaced by" + NL +
    83                  " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
    84                  "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"}};
    86     // Test with -nodeprecated option. The serialized-form.html should
    87     // ignore the -nodeprecated tag and display the deprecation info. This
    88     // test is similar to the normal run of javadoc in which inline comment, tags
    89     // and deprecation information will be displayed.
    90     private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
    92     // Test with -nodeprecated and -nocomment options. The serialized-form.html should
    93     // ignore the -nodeprecated tag and display the deprecation info but should not
    94     // display the inline comments and tags. This test is similar to the test with
    95     // -nocomment option.
    96     private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
    98     private static final String[] ARGS1 =
    99         new String[] {
   100             "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
   102     private static final String[] ARGS2 =
   103         new String[] {
   104             "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
   106     private static final String[] ARGS3 =
   107         new String[] {
   108             "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
   110     private static final String[] ARGS4 =
   111         new String[] {
   112             "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
   114     /**
   115      * The entry point of the test.
   116      * @param args the array of command line arguments.
   117      */
   118     public static void main(String[] args) {
   119         TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
   120         tester.exactNewlineMatch = false;
   121         run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
   122         run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
   123         run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
   124         run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
   125         tester.printSummary();
   126     }
   128     /**
   129      * {@inheritDoc}
   130      */
   131     public String getBugId() {
   132         return BUG_ID;
   133     }
   135     /**
   136      * {@inheritDoc}
   137      */
   138     public String getBugName() {
   139         return getClass().getName();
   140     }
   141 }

mercurial