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

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

mercurial